Поделиться через


Threads.Item Method

Returns a Thread object in a Threads collection.

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

Syntax

'Declaration
Function Item ( _
    index As Object _
) As Thread
Thread Item(
    Object index
)
Thread^ Item(
    [InAttribute] Object^ index
)
abstract Item : 
        index:Object -> Thread 
function Item(
    index : Object
) : Thread

Parameters

Return Value

Type: EnvDTE.Thread
A Thread object.

Remarks

The Item method throws a System.ArgumentException exception if the collection cannot find the object that corresponds to the index value.

Examples

The following example demonstrates how to use the Item method.

To test this method:

  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 ThreadsItem(DTE dte)
{
    EnvDTE.Threads threads = dte.Debugger.CurrentProgram.Threads;
    MessageBox.Show("\nThe thread name: " + 
                    threads.Item(2).Name, "Testing Threads Item Method");
}
Shared Sub ThreadsItem(ByRef dte As EnvDTE.DTE)
    Dim threads As EnvDTE.Threads = dte.Debugger.CurrentProgram.Threads
    MessageBox.Show("The thread name: " + threads.Item(2).Name, _
                    "Threads Test - Item Method")
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