本文整理匯總了VB.NET中System.Threading.ThreadAbortException.ExceptionState屬性的典型用法代碼示例。如果您正苦於以下問題:VB.NET ThreadAbortException.ExceptionState屬性的具體用法?VB.NET ThreadAbortException.ExceptionState怎麽用?VB.NET ThreadAbortException.ExceptionState使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類System.Threading.ThreadAbortException
的用法示例。
在下文中一共展示了ThreadAbortException.ExceptionState屬性的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: Test
' 導入命名空間
Imports System.Threading
Public Class Test
<MTAThread> _
Shared Sub Main()
Dim newThread As New Thread(AddressOf TestMethod)
newThread.Start()
Thread.Sleep(1000)
' Abort newThread.
Console.WriteLine("Main aborting new thread.")
newThread.Abort("Information from Main.")
' Wait for the thread to terminate.
newThread.Join()
Console.WriteLine("New thread terminated - Main exiting.")
End Sub
Shared Sub TestMethod()
Try
While True
Console.WriteLine("New thread running.")
Thread.Sleep(1000)
End While
Catch abortException As ThreadAbortException
Console.WriteLine( _
CType(abortException.ExceptionState, String))
End Try
End Sub
End Class