class-name & method that called currently executing code

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
 
A

Alex Papadimoulis

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top