Retrieve a list of current processes running on system c#
By Mash B
You can use the Process.GetProcesses static method to retrieve a list of current processes.
To retrieve a specific process by ID, call Process.GetProcessById. To retrieve a list of processes with a specific name, call Process.GetProcessesByName. To retrieve the current process, call Process.GetCurrentProcess.
The following code sample lists the process ID (PID) and process name of all
processes
visible to the assembly.
using System.Diagnostics;
foreach (Process p in Process.GetProcesses())
Console.WriteLine("{0}: {1}", p.Id, p.ProcessName);
To retrieve a specific process by ID, call Process.GetProcessById.
To retrieve a list of processes
with a specific name, call Process.GetProcessesByName.
To retrieve the current
process, call Process.GetCurrentProcess.
Retrieve a list of current processes running on system c# (995 Views)