我想同时从另一个类运行两个方法。显然,下面的代码不起作用。我怎么能这样做?
Node node = new Node();
EHNode ehnode = new EHNode();
Thread normalNode = new Thread(node.RunNode());
Thread ehNode = new Thread(ehnode.RunNode());
normalNode.Start();
ehNode.Start();
答案 0 :(得分: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();