Here is a cool little code snippet with done with reflection that actually is quite handy. Especially in a logging situation.
I tweaked the code a bit to be not “WhoCalledMe” but rather “WhoIsTheCallerOfMe” and as such could hide most of the logging in a base class. This is easily done by changing the row StackFrame stackFrame = stackTrace.GetFrame(1);
to StackFrame stackFrame = stackTrace.GetFrame(2);
Of course then you’ll have to check that the frame in question (2) exists.