1. Using System.Diagnostics.StackTrace:
var stackTrace = new StackTrace(true); foreach (var r in stackTrace.GetFrames()) { Console.WriteLine("Filename: {0} Method: {1} Line: {2} Column: {3} ", r.GetFileName(),r.GetMethod(), r.GetFileLineNumber(), r.GetFileColumnNumber() ); }
2. Using System.Environment:
Console.WriteLine(Environment.StackTrace);
No comments:
Post a Comment