Export (0) Print
Expand All

StackTrace.ToString Method

Builds a readable representation of the stack trace.

Namespace:  System.Diagnostics
Assembly:  mscorlib (in mscorlib.dll)

public override string ToString()

Return Value

Type: System.String
A readable representation of the stack trace.

The following code example writes stack trace information to an event log entry.

StackFrame fr = new StackFrame(1,true);
StackTrace st = new StackTrace(fr);
EventLog.WriteEntry(fr.GetMethod().Name,
                    st.ToString(),
                    EventLogEntryType.Warning);

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Supported in: Windows Phone 8.1

Supported in: Windows Phone Silverlight 8.1

Supported in: Windows Phone Silverlight 8
Show:
© 2015 Microsoft