C# Running Process List

A process, in the simplest terms, is a running application. The System.Diagnostics namespace contains functions that allow you to manage processes in a system.

using System.Diagnostics;

The Process class provides functionality to monitor system processes across the network, and to start and stop local system processes. You can retrieve detailed knowledge of process threads and modules both through the Process class itself.

Process[] process = Process.GetProcesses();

The process component obtains information about a group of properties all at once. After the Process component has obtained information about one member of any group, it will cache the values for the other properties in that group and not obtain new information about the other members of the group until you call the Refresh method.

The following C# program shows how to retrieve the process name and Memory Allocation of each process from a running system. Drag and drop a Button and ListBox control on your C# Form, and copy and paste the following source code on button click event.

Full Source C#
using System; using System.Windows.Forms; using System.Diagnostics; namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { Process[] process = Process.GetProcesses(); foreach (Process prs in process) { listBox1.Items.Add(prs.ProcessName + " (" + prs.PrivateMemorySize64.ToString()+ ")"); } } } }