Share via


Thread2.Collection プロパティ

このスレッドを含むコレクションを取得します。

名前空間:  EnvDTE90
アセンブリ:  EnvDTE90 (EnvDTE90.dll 内)

構文

'宣言
ReadOnly Property Collection As Threads
Threads Collection { get; }
property Threads^ Collection {
    Threads^ get ();
}
abstract Collection : Threads with get
function get Collection () : Threads

プロパティ値

型 : Threads
Threads コレクション。

Collection プロパティを使用する方法を次の例に示します。

このプロパティをテストするには

  1. ワーカー スレッドのコールバック メソッド内にブレークポイントを設定します。

  2. ターゲット アプリケーションをデバッグ モードで実行します。

  3. ブレークポイントでアプリケーションが停止したら、アドインを実行します。

public static void TestThreadProperties(DTE2 dte)
{
    // Setup debug Output window.
    Window w = 
      (Window)dte.Windows.Item(EnvDTE.Constants.vsWindowKindOutput);
    w.Visible = true;
    OutputWindow ow = (OutputWindow)w.Object;
    OutputWindowPane owp = ow.OutputWindowPanes.Add("Thread Test");
    owp.Activate();

    EnvDTE.Threads threads = dte.Debugger.CurrentProgram.Threads;
    owp.OutputString("\nNumber of items in the Thread collection: " + 
      threads.Item(1).Collection.Count + "\n");
    foreach(EnvDTE90.Thread2 thread in threads)
    {
        owp.OutputString("\nThread: " + thread.ID + "  Name: " + 
          thread.Name);
        owp.OutputString("\n  Edition of the environment : " + 
          thread.DTE.Edition);
        owp.OutputString("\n  Is alive                   : " + 
          thread.IsAlive);
        owp.OutputString("\n  Is frozen                  : " + 
          thread.IsFrozen);
        owp.OutputString("\n  Location                   : " + 
          thread.Location);
        owp.OutputString("\n  Parent's current mode      : " + 
          thread.Parent.CurrentMode);
        owp.OutputString("\n  Priority                   : " + 
          thread.Priority);
        owp.OutputString("\n  Program name               : " + 
          thread.Program.Name);
        owp.OutputString("\n  Number of stack frames     : " + 
          thread.StackFrames.Count);
        owp.OutputString("\n  Suspended number of times  : " + 
          thread.SuspendCount);
        owp.OutputString("\n  Flag on the thread  : " + thread.Flag);
    }
}
Shared Sub ThreadProperties(ByRef dte As EnvDTE80.DTE2)
    Dim str As String
    Dim threads As EnvDTE.Threads = dte.Debugger.CurrentProgram.Threads
    str = "Number of items in the Thread collection: " + _
      threads.Item(1).Collection.Count.ToString()
    For Each thread As EnvDTE90.Thread2 In threads
        str += vbCrLf + vbCrLf + "  Thread: " + thread.ID.ToString()
        str += vbCrLf + "    Edition of the environment: " + 
          thread.DTE.Edition
        str += vbCrLf + "    Is alive: " + thread.IsAlive.ToString()
        str += vbCrLf + "    Is frozen: " + thread.IsFrozen.ToString()
        str += vbCrLf + "    Location: " + thread.Location
        str += vbCrLf + "    Parent's current mode: " + _
               thread.Parent.CurrentMode.ToString()
        str += vbCrLf + "    Priority: " + thread.Priority
        str += vbCrLf + "    Program name: " + thread.Program.Name
        str += vbCrLf + "    Number of stack frames: " + _
               thread.StackFrames.Count.ToString()
        str += vbCrLf + "    Suspended number of times: " + _
               thread.SuspendCount.ToString()
        str += vbCrLf + "    Flag on the thread: " + _
               thread.Flag.ToString()
    Next
    MessageBox.Show(str, "Thread Test - Properties")
End Sub

.NET Framework セキュリティ

  • 直前の呼び出し元に対する完全な信頼。このメンバーは、部分的に信頼されているコードから使用することはできません。詳細については、「部分信頼コードからのライブラリの使用」を参照してください。

参照

関連項目

Thread2 インターフェイス

EnvDTE90 名前空間

その他の技術情報

スレッドとプロセスの操作

オートメーション オブジェクト モデルの階層図

方法 : [スレッド] ウィンドウを使用する