How-To Geek
Get a List of Threads in a Process
The System.Diagnostics namespace contains functions that allow you to manage processes, threads, eventlogs and performance information.
The System.Diagnostics.Process object gives you access to functionality enabling you to manage system processes and threads.
Add this line to your using list:
using System.Diagnostics;
You can get a list of ProcessThreads in a process by using the Process.Threads property, which returns a ProcessThreadCollection object.
Here’s a code example for you, assuming that you already have a Process object named theProcess.
ProcessThreadCollection threadlist = theProcess.Threads; foreach(ProcessThread theThread in threadlist){ Console.WriteLine("Thread ID:{0} Priority: {1} Started: {2}", theThread.Id, theThread.PriorityLevel, theThread.StartTime); }
|
Subscribe |
Daily Email Updates |
|
You can get our how-to articles in your inbox each day for free. Just enter your email below: |
- By The Geek on 11/23/06
Comments (2)
Comments are closed on this post.
If you'd like to continue the discussion on this topic, you can do so at our forum.
Go to the Forum

it’s so very nice
in this site more also c# for windows application
and java script
It’s bad,
this is processthread collection, not managet thread. Doesnt corespond with System.Thread , cant find by name of thread etc.