When logging in C#, how can I learn the name of the method that called the current method? I know all about System.Reflection.MethodBase.GetCurrentMethod(), but
System.Reflection.MethodBase.GetCurrentMethod()
private static MethodBase GetCallingMethod() { return new StackFrame(2, false).GetMethod(); } private static Type GetCallingType() { return new StackFrame(2, false).GetMethod().DeclaringType; }
A fantastic class is here: http://www.csharp411.com/c-get-calling-method/