Consider the following code:
private static void WriteProcesses(StreamWriter sw, DateTime d) {
sw.WriteLine("List of processes @ " + d.ToString());
Process[] localAll = Process.GetProcesses().Where(o => o.ProcessName.ToLower() != "svchost");
if(localAll.Length > 0) {
for(int i = 0; i < localAll.Length; i++) {
sw.WriteLine(" " + localAll[i].ProcessName);
}
}
}
But i get a red squiggly line saying:
Cannot implicitly convert type System.Collections.Generic.IEnumerable' to 'System.Diagnostics.Process[]'. An explicit conversion exists (are you missing a cast?)
I tried changing the array to a List but didnt work.