How to Get a List of Running Processes in C#

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. We will use this object to get a list of running processes.

Add this line to your using list:

using System.Diagnostics;

Now you can get a list of the processes with the Process.GetProcesses() method,

as seen in this example:

Process[] processlist = Process.GetProcesses();

foreach(Process theprocess in processlist){
Console.WriteLine(“Process: {0} ID: {1}”,

theprocess.ProcessName, theprocess.Id);

Some interesting properties of the Process object:

p.StartTime (Shows the time the process started)
p.TotalProcessorTime (Shows the amount of CPU time the process has taken)
p.Threads ( gives access to the collection of threads in the process)

The .NET framework really makes things simple!

3 responses to this post.

  1. i like using photopolymer plates not the metal backed ones and photo sensitive film. what i desired to ask about: i saw a few world wide web sites that show what they call “Ghetto Kiln(s)” made with a flower pot covered in aluminum, clothing hanger bent like a handle, sitting atop a campfire butane/propane like stove eye, the main goal to burn out wax for your mold. what do you think can be used if i wanted to generate a mold piece of my precious metal clay perform either from the photopolymer plate and/or the actual silver or silicone negative mold. also what do you think of using sand casting and/or cuttlefish/tufa stone casting?

  2. I want an individual now, ive been waiting for sooooo long to have it!!! damn!

  3. Internet is a source of information and knowledge. But there are so many sites in net which are nothing but gibberish. But when I visit your site – I felt that – in net there are lots of sites (like this) from where I can get lot of information too. And if I say truly – your site is fantastic. I’ve bookmarked your site in my browser; I hope in future days I’ll get more valuable information from your site.

Comments are closed.

%d bloggers like this: