I want to create a c# program where i have to check processes which are currently running and close a particular of them can any one help me

using System.IO;
using System.Diagnostics;
//name is the process name passed to the funciton
//public bool isProcRunning(String name)
public void isProcRunning(String name)


            foreach (Process clsProcess in Process.GetProcesses())


                if (clsProcess.ProcessName.Contains(name))

                {//return true;

// return false;


Thanks both of that really helped me