Process.Threads 屬性

定義

取得正在相關的處理序中執行的執行緒集。Gets the set of threads that are running in the associated process.

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

屬性值

ProcessThread 類型的陣列,代表目前正在相關聯處理序中執行的作業系統執行緒。An array of type ProcessThread representing the operating system threads currently running in the associated process.

屬性

例外狀況

處理序沒有 Id,或沒有與 Process 執行個體關聯的處理序。The process does not have an Id, or no process is associated with the Process instance.

-或--or- 關聯處理序已結束。The associated process has exited.

備註

執行緒會在進程中執行程式碼。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.

使用 ProcessThread 來取得與目前進程相關聯的所有線程。Use ProcessThread to get all the threads associated with the current process. 主要執行緒不一定要位於陣列中的索引零。The primary thread is not necessarily at index zero in the array.

安全性

LinkDemand
針對立即呼叫者的完全信任的。for full trust for the immediate caller. 這個成員無法供部分信任的程式碼使用。This member cannot be used by partially trusted code.

適用於

另請參閱