524
using System.Diagnostics;
...
var st = new StackTrace();
var sf = st.GetFrame(0);
var currentMethodName = sf.GetMethod();
Or, if you'd like to have a helper method:
[MethodImpl(MethodImplOptions.NoInlining)]
public static string GetCurrentMethod()
{
var st = new StackTrace();
var sf = st.GetFrame(1);
return sf.GetMethod().Name;
}
Updated with credits to @stusmith.
Does this not work?
System.Reflection.MethodBase.GetCurrentMethod()
Returns a MethodBase object representing the currently executing method.
Namespace: System.Reflection
Assembly: mscorlib (in mscorlib.dll)
http://msdn.microsoft.com/en-us/library/system.reflection.methodbase.getcurrentmethod.aspx