Access Specific Running Process Via P I D C# with Example
using System; using System.Linq; using System.Diagnostics; namespace CSharpMultiThreading { class MainMethodClass { static void Main() { GetSpecificProcess(0); } // If there is no process with the PID of 987, a runtime exception will be thrown. static void GetSpecificProcess(int pid) { Process theProc = null; try { theProc = Process.GetProcessById(pid); Console.WriteLine("Process Name: {0}", theProc.ProcessName); } catch(ArgumentException ex) { Console.WriteLine(ex.Message); } } } }