trace of function call
how can i trace source (class or namespace) of function call inside of code?
System.Diagnostics.StackTrace trace = new System.Diagnostics.StackTrace(); System.Diagnostics.Debug.Assert(trace.FrameCount > 0); Console.WriteLine(trace.GetFrame(0).GetMethod().Name); |
trace.GetFrame(0).GetMethod().DeclaringType.Namespace |
trace.GetFrame(0).GetMethod().DeclaringType.Name |
Using StackTrace you can get all frames upto the bottom of the stack.