New StackTrace : StackTrace « System.Diagnostics « VB.Net by API






New StackTrace

   


public class Test
   public Shared Sub Main
        CalculateEmployeeSalaries()
   End Sub
    Private Shared Sub CalculateEmployeeSalaries()
        CheckVacationPay()
    End Sub

    Private Shared Sub CheckVacationPay()
        ShowCallStack()
    End Sub


    Private Shared Sub ShowCallStack()
        Dim stack_trace As New System.Diagnostics.StackTrace(True)
        For i As Integer = 0 To stack_trace.FrameCount - 1
            With stack_trace.GetFrame(i)
                Console.WriteLine("Method: " & .GetMethod().ToString)
                Console.WriteLine("File: " & .GetFileName())
                Console.WriteLine("Line: " & .GetFileLineNumber())
            End With
        Next i

    End Sub

End class

   
    
    
  








Related examples in the same category