Process.Threads Property

Definition

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

public System.Diagnostics.ProcessThreadCollection Threads { get; }
[System.ComponentModel.Browsable(false)]
public System.Diagnostics.ProcessThreadCollection Threads { get; }

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

Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1

See also