天天看點

c#列印目前所有線程

轉: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);

            }

c#