Last active
January 10, 2018 14:18
-
-
Save ankitvijay/3b97e87690fc928d38feb2379678d958 to your computer and use it in GitHub Desktop.
Obsolete Attribute Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class Logger | |
{ | |
public static void Log(string message, | |
[CallerFilePath] string sourceFilePath = "", | |
[CallerLineNumber] int sourceLineNumber = 0, | |
[CallerMemberName] string callerMemberName = "") | |
{ | |
Log($"[Message]: {message}; [Source File Path]: {sourceFilePath}; " + | |
$"[Source Line Number]: {sourceLineNumber}; [Caller Member Name]: {callerMemberName}; "); | |
} | |
[Obsolete("This method is will be removed in the future. Use Log(string message) instead.")] | |
public static void Log(string message, string callerMemberName) | |
{ | |
Log($"[Message]: {message}; [Caller Member Name]: {callerMemberName}; "); | |
} | |
private static void Log(string message) | |
{ | |
Debug.WriteLine(message); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment