VB.Net by API/System.Diagnostics/StackTrace
Версия от 16:40, 26 мая 2010; (обсуждение)
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