Dan,
In this case, you would want to create an instance of the StackFrame
class, passing 1 to the constructor indicating that you want to get the
stack frame for the one above the currently executing code.
Once there, you can get the MethodInfo instance for that method, and get
the name of the method, as well as the type.
However, this can have a hit on performance (walking the stack usually
does).
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)
Dan said:
I'm implementing a tracing class with a WriteLine method, and would like
to
record the name of the function which is calling WriteLine. Is there a
way
to do this?