Jump to content
Tuts 4 You

Need help fixing a line.


Invoked

Recommended Posts

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
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
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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...