I have a Problem with multithreadding. VS2010 don't accept "sendCom(IP, com)". Error: expacted method name
private void sendCom(String com) { //send command int i=0; String IP; foreach (var item in checkedListBox1.CheckedItems) { Console.WriteLine(item.ToString()); IP = getIP(item); theThreads[i] = new Thread(new ThreadStart( sendCom(IP, com) )); i++; } } private void sendCom(String IP, String com) { theSSHclass.RunSingleCom(IP, com); }
ThreadStartwraps a method to execute, the not result of execution.new Thread(new ThreadStart(() => sendCom(IP, com)));