C# Environment StackTrace
Description
Environment StackTrace
gets current stack trace information.
Syntax
Environment.StackTrace
has the following syntax.
public static string StackTrace { get; }
Parameters
Environment.StackTrace
has the following parameters.
- The full name of the class, including the namespace.
- The name of the method.
- The list of parameter type/name pairs. Each pair is separated by a comma (","). This information is omitted if MethodName takes no parameters.
- The name of the source file where the MethodName method is declared. This information is omitted if debug symbols are not available.
- The number of the line in FileName that contains the source code from MethodName for the instruction that is on the call stack. This information is omitted if debug symbols are not available.
Example
The following example demonstrates the StackTrace property.
//from ww w .ja va 2 s.c om
using System;
class Sample
{
public static void Main()
{
Console.WriteLine("StackTrace: '{0}'", Environment.StackTrace);
}
}
The code above generates the following result.