ThreadAbortException.ExceptionState プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > ThreadAbortException.ExceptionState プロパティの意味・解説 

ThreadAbortException.ExceptionState プロパティ

スレッド中止関連するアプリケーション固有の情報を含むオブジェクト取得します

名前空間: System.Threading
アセンブリ: mscorlib (mscorlib.dll 内)
構文構文

Dim instance As ThreadAbortException
Dim value As Object

value = instance.ExceptionState
public Object ExceptionState { get; }
public:
property Object^ ExceptionState {
    Object^ get ();
}
/** @property */
public Object get_ExceptionState ()
public function get ExceptionState
 () : Object

プロパティ
アプリケーション固有の情報を含むオブジェクト

解説解説
使用例使用例

中止するスレッド情報を渡す方法の例を次に示します

Imports System
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
using System;
using System.Threading;

class Test
{
    public static void Main()
    {
        Thread newThread  = new Thread(new
 ThreadStart(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.");
    }

    static void TestMethod()
    {
        try
        {
            while(true)
            {
                Console.WriteLine("New thread running.");
                Thread.Sleep(1000);
            }
        }
        catch(ThreadAbortException abortException)
        {
            Console.WriteLine((string)abortException.ExceptionState);
        }
    }
}
using namespace System;
using namespace System::Threading;
ref class Test
{
private:
   Test(){}


public:
   static void TestMethod()
   {
      try
      {
         while ( true )
         {
            Console::WriteLine( "New thread running." );
            Thread::Sleep( 1000 );
         }
      }
      catch ( ThreadAbortException^ abortException ) 
      {
         Console::WriteLine( dynamic_cast<String^>(abortException->ExceptionState)
 );
      }

   }

};

int main()
{
   Thread^ newThread = gcnew Thread( gcnew ThreadStart( &Test::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." );
}

import System.*;
import System.Threading.*;
import System.Threading.Thread;    

class Test
{
    public static void main(String[]
 args)
    {
        Thread newThread = new Thread(new ThreadStart(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.");
    } //main

    static void TestMethod()
    {
        try {
            while (true) {
                Console.WriteLine("New thread running.");
                Thread.Sleep(1000);
            }
        }
        catch (ThreadAbortException abortException) {
            Console.WriteLine((System.String)(abortException.
                get_ExceptionState()));
        }
    } //TestMethod
} //Test
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ThreadAbortException クラス
ThreadAbortException メンバ
System.Threading 名前空間
Thread.CurrentThread プロパティ
Thread.Abort
その他の技術情報
スレッド破棄


このページでは「.NET Framework クラス ライブラリ リファレンス」からThreadAbortException.ExceptionState プロパティを検索した結果を表示しています。
Weblioに収録されているすべての辞書からThreadAbortException.ExceptionState プロパティを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からThreadAbortException.ExceptionState プロパティ を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

ThreadAbortException.ExceptionState プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



ThreadAbortException.ExceptionState プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS