Created
March 28, 2014 11:02
-
-
Save rickyah/9830208 to your computer and use it in GitHub Desktop.
Get the currently executing method name in .NET/Mono
This file contains hidden or 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
[MethodImpl(MethodImplOptions.NoInlining)] | |
public string GetCurrentMethodName() | |
{ | |
StackTrace st = new StackTrace (); | |
StackFrame sf = st.GetFrame (1); | |
MethodBase method = sf.GetMethod(); | |
return method.DeclaringType.FullName + ':' + sf.GetMethod().Name; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment