Process.Threads Property

Definition

Gets the set of threads that are running in the associated process.

public:
 property System::Diagnostics::ProcessThreadCollection ^ Threads { System::Diagnostics::ProcessThreadCollection ^ get(); };
public System.Diagnostics.ProcessThreadCollection Threads { get; }
[System.ComponentModel.Browsable(false)]
public System.Diagnostics.ProcessThreadCollection Threads { get; }
member this.Threads : System.Diagnostics.ProcessThreadCollection
[<System.ComponentModel.Browsable(false)>]
member this.Threads : System.Diagnostics.ProcessThreadCollection
Public ReadOnly Property Threads As ProcessThreadCollection

Property Value

An array of type ProcessThread representing the operating system threads currently running in the associated process.

Attributes

Exceptions

The process does not have an Id, or no process is associated with the Process instance.

-or-

The associated process has exited.

Remarks

The value returned by this property represents the most recently refreshed threads. To get the most up to date information, you need to call Refresh() method first.

A thread executes code in a process. Each process is started with a single thread, its primary thread. Any thread can create additional threads. Threads within a process share the address space of the process.

Use ProcessThread to get all the threads associated with the current process. The primary thread is not necessarily at index zero in the array.

Applies to

See also