我正在尝试遍历 XmlNodeList,从中获取一些数据,然后启动一个使用该数据的新线程。
这是我到目前为止所拥有的:
public void startRun(string kwd)
{
doRun run = new doRun();
run.run(kwd);
}
private void startBtn_Click(object sender, EventArgs e)
{
XmlDocument searches = new XmlDocument();
searches.Load("data\\Searches.xml");
XmlNodeList search = searches.SelectNodes("Searches/search");
var nodeCount = search.Count;
for(var i = 0; i < nodeCount; i++)
{
string kwd = System.Uri.EscapeDataString(search[i].SelectSingleNode("query").InnerText);
doRun run = new doRun(this);
Thread newThread = new Thread( new ThreadStart( startRun(kwd) ) );
}
}
这根本行不通。Visual StudioMethod name expected
对这一行说:
Thread newThread = new Thread( new ThreadStart( startRun(kwd) ) );
如何将此参数传递给新的主题?