轉:https://stackoverflow.com/questions/10315862/get-list-of-threads
ProcessThreadCollection currentThreads = Process.GetCurrentProcess().Threads;
Console.WriteLine("threadCount:" + currentThreads.Count);
foreach (ProcessThread thread in currentThreads)
{
Console.WriteLine("threadId:"+thread.Id);
}