VB.Net Tutorial/Development/StackTrace — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Версия 16:40, 26 мая 2010
Print Stack TraceImports System.Diagnostics
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
Method: Void ShowCallStack() File: Line: 0 Method: Void Main() File: Line: 0