Created
March 24, 2018 10:59
-
-
Save andylshort/cdc5ec88c2e2b9e8bd6ab947a17411ce to your computer and use it in GitHub Desktop.
Gets the name of the currently executing method
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
// Requires: | |
// using System.Diagnostics; | |
// using System.Runtime.CompilerServices; | |
[MethodImpl(MethodImplOptions.NoInlining)] | |
public static string GetCurrentMethod() | |
{ | |
StackTrace st = new StackTrace(); | |
StackFrame sf = st.GetFrame(1); | |
return sf.GetMethod().Name; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment