Sometimes it is easy to print the methodname of the current method. This can be typed manually, but with use of Reflection this can be retrieved with the following simple command:
System.Reflection.MethodBase.GetCurrentMethod().Name
Supercharge your debugging with git bisect
4 days ago
That'll work, but you got to remember that the JIT could possibly do an inline when compiled in release mode, so if you *really* need to get the name of the current method, you should put a MethodImplAttribute on it telling it to disable inlining.
ReplyDelete[MethodImpl(MethodImplOptions. NoInlining)]
public void Hello()
{
//Omitted
}