Posted May 4, 20205 yr Hello everyone. Im fairly new to c# and currently learning it ,but I came up on an error. I had someone suggest me to use an array ,but I still get errors. Any tips? Code: foreach (Process process in Process.GetProcessesByName("dnspy-x86")) { Environment.Exit(0); } I want it to accept more then 1 process. thanks !
May 4, 20205 yr Process[] processlist = Process.GetProcesses(); foreach(Process process in processlist){ if(process.ProcessName=="process1" || process.ProcessName=="process2" || ......){ // do whatever you want } } i think this will work
May 4, 20205 yr Author 4 hours ago, Ahmad_k said: Process[] processlist = Process.GetProcesses(); foreach(Process process in processlist){ if(process.ProcessName=="process1" || process.ProcessName=="process2" || ......){ // do whatever you want } } i think this will work thanks !
Create an account or sign in to comment