Process.Threads 屬性

定義

取得正在相關的處理序中執行的執行緒集。

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

屬性值

ProcessThread 類型的陣列,代表目前正在相關聯處理序中執行的作業系統執行緒。

屬性

例外狀況

處理序沒有 Id,或沒有與 Process 執行個體關聯的處理序。

-或-

關聯處理序已結束。

備註

這個屬性傳回的值代表最近重新整理的線程。 若要取得最新的資訊,您必須先呼叫 Refresh() 方法。

線程會在進程中執行程序代碼。 每個進程都是以單一線程啟動,其主要線程。 任何線程都可以建立其他線程。 進程內的線程會共用進程的位址空間。

使用 ProcessThread 取得與目前進程相關聯的所有線程。 主要線程不一定位於陣列中的索引零。

適用於

產品 版本
.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

另請參閱