Invoked Posted May 4, 2020 Share Posted May 4, 2020 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 ! Link to comment
Ahmad_k Posted May 4, 2020 Share Posted May 4, 2020 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 Link to comment
Invoked Posted May 4, 2020 Author Share Posted May 4, 2020 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 ! Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now