Jump to content
Tuts 4 You
Sign in to follow this  
Invoked

Need help fixing a line.

Recommended Posts

Invoked

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 !

Share this post


Link to post
Ahmad_k
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

Share this post


Link to post
Invoked
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 !

Share this post


Link to post

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
Sign in to follow this  
×
×
  • Create New...