programming-examples/c-sharp/DataStructures/C# Program to Create an Instance of StackTrace and to Get all Frames.cs

30 lines
684 B
C#
Raw Normal View History

2019-11-15 12:59:38 +01:00
/*
* C# Program to Create an Instance of StackTrace and to Get all Frames
*/
using System.Diagnostics;
using System;
class program
{
public static void Main()
{
StackTrace stackTrace = new StackTrace();
StackFrame[] stackFrames = stackTrace.GetFrames();
// write call stack method names
Console.WriteLine("Method Names : ");
foreach (StackFrame stackFrame in stackFrames)
{
Console.WriteLine(stackFrame.GetMethod().Name);
}
Console.Read();
}
}
/*
Method Names :
Main
nExecuteAssembly
ExecuteAssembly
RunUsersAssembly
ThreadStart_Context
Run
ThreadStart