0
我有一個多線程問題。 VS2010不接受「sendCom(IP,com)」。錯誤:expacted方法名無法使用方法調用創建新線程
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);
}
'ThreadStart'包裝一個方法來執行,執行的不是* result *。 – 2013-04-04 23:57:25
你可以發佈一個exsample如何使它正確嗎? – tux007 2013-04-05 00:00:06
使用'new Thread(new ThreadStart(()=> sendCom(IP,com)));' – 2013-04-05 00:07:39