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
Deserializing JSON to a string or a value
6 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
}