views:

1002

answers:

3

How can I get programmatic access to the call stack?

+15  A: 

Try System.Diagnostics.StackTrace.

Matt Hamilton
+5  A: 

You can use the StackTrace and StrackFrame classes in System.Diagnostics.

James Avery
A: 

@Brad, the right way is to use the StackTrace and StackFrame classes as James mentions. Throwing an exception just to get the stack trace is completely misusing exceptions.

Scott Dorman