Look at StackTrace class


new
StackTrace().GetFrame(1).GetMethod().Name returns the calling method name. This information will help in tracing. We can see call hierarchy of a method by using below code:

 

for (int i = 0; i < new StackTrace().FrameCount; i++)

{

Console.WriteLine(new StackTrace().GetFrame(i).GetMethod().Name);

}

Next Recommended Reading Look at Microsoft Sync Framework 1.0