Q:

Comparing two arraylist in c# windows application

I have the arraylist which has some process names like "Notepad", "mspaint"
I want to check the values of above arraylist against the following :
Process[] Procs = Process.GetProcesses();
If the process "Notepad" is not there in Procs, then i want to use that value
for further requirement.
How do i find the value of my arraylist which is missing in Procs ??

A:

There are smarter answers, but i will post a naive one because its easier to understand
List<string> myprocs; // populated with process names
Process[] Procs = Process.GetProcesses();
foreach(Process proc in Procs)
{
  if(myprocs.Contains(proc.ProcessName))
  {
     myprocs.Remove(proc.ProcessName);
  }
}
// whatever that is left over in myprocs at this point is your remainder process names.

