0

我想同时从另一个类运行两个方法。显然,下面的代码将不起作用。我怎么能做这样的事情?

Node node = new Node();
EHNode ehnode = new EHNode();

Thread normalNode = new Thread(node.RunNode());
Thread ehNode = new Thread(ehnode.RunNode());

normalNode.Start();
ehNode.Start();
4

1 回答 1

1

这将有助于:

Node node = new Node();
EHNode ehnode = new EHNode();

Thread normalNode = new Thread(new ThreadStart(node.RunNode));
Thread ehNode = new Thread(new ThreadStart(ehnode.RunNode));

normalNode.Start();
ehNode.Start();
于 2013-03-13T05:38:21.313 回答