class-name & method that called currently executing code

  • Thread starter Thread starter John A Grandy
  • Start date Start date
J

John A Grandy

somewhere in the .net framework libs , is the following intrinsically
supplied


1. class-name & method that called the currently executing code

2. for overriden methods within a multi-generation class hierarchy, the
class-name ultimate caller
 
John,

I'm sure you know this already ... but standard caveat. You don't want to
vary the output of a function based on the caller. So, use this only for
debugging ;-)

#1 Debug.WriteLine( "MethodName=" & (New
System.Diagnostics.StackTrace(True)).GetFrame(1).GetMethod() )

#2 Debug.WriteLine( myObject.GetType.BaseType.ToString()

-- Alex Papadimoulis
 
Back
Top