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.FrameCou nt; frameCount++)
{
sFrame = sTrace.GetFrame (frameCount);
MethodBase currentMethod = sFrame.GetMetho d();
//If the Type in the frame is the type that is being searched
if(currentMetho d.ReflectedType .FullName == current.FullNam e)
{
//get the method and its parameter info
//then exit out of the for loop
break;
}
}
Thanks again
CGuy
"CGuy" <cg**@csharp.ne t> wrote in message
news:OC******** ******@TK2MSFTN GP12.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