Compartir a través de


Threads.Count Property

Gets a value indicating the number of objects in the Threads collection.

Namespace:  EnvDTE
Assembly:  EnvDTE (in EnvDTE.dll)

Syntax

'Declaration
ReadOnly Property Count As Integer
int Count { get; }
property int Count {
    int get ();
}
abstract Count : int with get
function get Count () : int

Property Value

Type: System.Int32
An integer value indicating the number of objects in the Threads collection.

Examples

The following example demonstrates how to use the Count property.

To test this property:

  1. Set the breakpoint inside the worker thread callback method.

  2. Run the target application in the debug mode.

  3. When the application stops on the breakpoint, run the add-in.

public static void ThreadsCount(DTE dte)
{
    EnvDTE.Threads threads = dte.Debugger.CurrentProgram.Threads;
    EnvDTE.StackFrames stackFrames = dte.Debugger.CurrentThread.StackFrames;
    MessageBox.Show("\nThere are  " + threads.Count + 
                    " threads running.\n", "Threads Count Property Test" );
}
Shared Sub ThreadsCount(ByRef dte As EnvDTE.DTE)
    Dim threads As EnvDTE.Threads = dte.Debugger.CurrentProgram.Threads
    MessageBox.Show("There are " + threads.Count.ToString() + _
                    " threads running", "Threads Test - Count Property")
End Sub

.NET Framework Security

See Also

Reference

Threads Interface

EnvDTE Namespace

Other Resources

How to: Compile and Run the Automation Object Model Code Examples