本文整理汇总了VB.NET中System.Diagnostics.StackTrace.StackTrace构造函数的典型用法代码示例。如果您正苦于以下问题:VB.NET StackTrace构造函数的具体用法?VB.NET StackTrace怎么用?VB.NET StackTrace使用的例子?那么恭喜您, 这里精选的构造函数代码示例或许可以为您提供帮助。您也可以进一步了解该构造函数所在类System.Diagnostics.StackTrace 的用法示例。
在下文中一共展示了StackTrace构造函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的VB.NET代码示例。
示例1: StackTrace
Public Sub Level5Method()
Try
Dim nestedClass As New ClassLevel6()
nestedClass.Level6Method()
Catch e As Exception
Console.WriteLine(" Level5Method exception handler")
Dim st As New StackTrace()
' Display the most recent function call.
Dim sf As StackFrame = st.GetFrame(0)
Console.WriteLine()
Console.WriteLine(" Exception in method: ")
Console.WriteLine(" {0}", sf.GetMethod())
If st.FrameCount > 1 Then
' Display the highest-level function call in the trace.
sf = st.GetFrame((st.FrameCount - 1))
Console.WriteLine(" Original function call at top of call stack):")
Console.WriteLine(" {0}", sf.GetMethod())
End If
Console.WriteLine()
Console.WriteLine(" ... throwing exception to next level ...")
Console.WriteLine("-------------------------------------------------")
Console.WriteLine()
Throw e
End Try
End Sub
开发者ID:VB.NET开发者,项目名称:System.Diagnostics,代码行数:29,代码来源:StackTrace
示例2: StackTrace
Public Sub Level2Method()
Try
Dim nestedClass As New ClassLevel3
nestedClass.Level3Method()
Catch e As Exception
Console.WriteLine(" Level2Method exception handler")
' Display the full call stack at this level.
Dim st1 As New StackTrace(True)
Console.WriteLine(" Stack trace for this level: {0}", _
st1.ToString())
' Build a stack trace from one frame, skipping the current
' frame and using the next frame.
Dim st2 As New StackTrace(New StackFrame(1, True))
Console.WriteLine(" Stack trace built with next level frame: {0}", _
st2.ToString())
' Build a stack trace skipping the current frame, and
' including all the other frames.
Dim st3 As New StackTrace(1, True)
Console.WriteLine(" Stack trace built from the next level up: {0}", _
st3.ToString())
Console.WriteLine()
Console.WriteLine(" ... throwing exception to next level ...")
Console.WriteLine("-------------------------------------------------")
Console.WriteLine()
Throw e
End Try
End Sub
开发者ID:VB.NET开发者,项目名称:System.Diagnostics,代码行数:32,代码来源:StackTrace
示例3: StackFrame
Dim frame As New StackFrame(1, True)
Dim strace As New StackTrace(frame)
EventLog.WriteEntry(frame.GetMethod().Name, _
strace.ToString(), _
EventLogEntryType.Warning)
开发者ID:VB.NET开发者,项目名称:System.Diagnostics,代码行数:6,代码来源:StackTrace
注:本文中的System.Diagnostics.StackTrace.StackTrace构造函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论