Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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