首页 > 代码库 > C# 当前程序所有线程

C# 当前程序所有线程

using System.Linq;

var threads = System.Diagnostics.Process.GetCurrentProcess().Threads;
var count = threads.Count;
var actived = threads.Cast<ProcessThread>().Where(t => t.ThreadState == System.Diagnostics.ThreadState.Running).ToList();