小编典典

获取线程列表

c#

我想列出所有正在运行的线程,但不要使用List<>该类。我想动态观察正在运行的线程。我怎样才能做到这一点?


阅读 444

收藏
2020-05-19

共1个答案

小编典典

using System.Diagnostics;

ProcessThreadCollection currentThreads = Process.GetCurrentProcess().Threads;

foreach (ProcessThread thread in currentThreads)    
{
   // Do whatever you need
}
2020-05-19