Process.Threads 属性
定义
获取在关联进程中运行的一组线程。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
属性值
类型 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.
注解
此属性返回的值表示最近刷新的线程。The value returned by this property represents the most recently refreshed threads. 若要获取最新信息,需要 Refresh() 首先调用方法。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.
使用 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.