Thread.Collection Property

Definition

Gets the collection that contains the object that supports this property or that is contained in this code construct. Returns null for an object that is not obtained from a collection.

public:
 property EnvDTE::Threads ^ Collection { EnvDTE::Threads ^ get(); };

Property Value

A Threads collection.

Attributes

Examples

The following example demonstrates how to use the Collection property.

public static void TestThreadProperties(DTE 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(EnvDTE.Thread 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);  
    }  
}  

Applies to

Produkt Verze
Visual Studio SDK 2015, 2017, 2019, 2022