C#: Display all processes running

This entry is part 66 of 71 in the series C#

The GetProcesses method allows us to display processes running in the local computer.

We can use this method to create an array of Process components running in your computer.

We have included System.Diagnostics as GetProcesses is a method under this namespace.

using System;
using System.Diagnostics;

namespace Processes
    class Program
        static void Main(string[] args)
            Process[] processlist = Process.GetProcesses();

            foreach (Process process in processlist)
                Console.WriteLine("Process: {0} ID: {1}", process.ProcessName, process.Id);


Series Navigation<< C#: Random number generation
C#: Checking if a process is running >>

Leave a comment

Leave a Reply