Thank you guys..
Here is how I finally did it
sTrace = new StackTrace(true);
//loop through all the stack frames
for(Int32 frameCount = 0; frameCount < sTrace.FrameCount; frameCount++)
{
sFrame = sTrace.GetFrame(frameCount);
MethodBase currentMethod = sFrame.GetMethod();
//If the Type in the frame is the type that is being searched
if(currentMethod.ReflectedType.FullName == current.FullName)
{
//get the method and its parameter info
//then exit out of the for loop
break;
}
}
Thanks again
CGuy
"CGuy" <cg**@csharp.net> wrote in message
news:OC**************@TK2MSFTNGP12.phx.gbl...
Hi,
I'm trying to implement a custom trace listener. I would like the
WriteLine method of this tracelistener to also write out information
regarding the method from which Trace was called. For example,
public void Method1()
{
Trace.WriteLine("Sample Text");
}
public void Method2()
{
Trace.WriteLine("Sample Text");
}
Executing the aboce 2 Trace.WriteLine methods should also give me the name
of the method and its signature in the trace listener
Regards,
CGuy