Jump to content
Tuts 4 You

Need help fixing a line.


Invoked

Recommended Posts

Posted

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 !

Posted
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

Posted
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

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