【发布时间】:2012-04-09 20:26:23
【问题描述】:
我想编写一个运行多个线程的方法,并且我希望在我的方法结束之前使用 async/await 确保所有线程都已完成。我该怎么做?
请考虑这个伪代码:
private async void SomeWork()
{
var a = doWork1();
var b = doWork2();
var c = doWork3();
var d = doWork4();
...
//I want to assure that all of above thread are complete using `C#-5` new features
}
我该怎么做?
【问题讨论】:
标签: c# multithreading async-ctp c#-5.0