Process.Threads 屬性

定義

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

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

屬性值

ProcessThreadCollection

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

屬性

例外狀況

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

-或-

關聯處理序已結束。

備註

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

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

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

適用於

另請參閱