Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@rickyah
Created March 28, 2014 11:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rickyah/9830208 to your computer and use it in GitHub Desktop.
Save rickyah/9830208 to your computer and use it in GitHub Desktop.
Get the currently executing method name in .NET/Mono
[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