Home > Development > Listing Processes in C#

Listing Processes in C#

If you need to get a list of processes in .NET use the Process.GetProcesses() method from System.Diagnostics namespace.

Notice the try catch in the code to prevent access denied exceptions.

using System;
using System.Diagnostics;

namespace GenericExamples
    class Program
        static void Main()

                x =>
                            Console.WriteLine("{0}, {1}, {2}, {3}, {4}", x.Id, x.ProcessName, x.Threads.Count, x.PriorityClass,


Categories: Development Tags: , , ,
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: