Ser*_*erG 4 .net c# exception-handling wait task-parallel-library
根据MSDN Task.WaitAll在执行至少一个Task实例期间抛出异常时立即通过AggregateException.我需要等待所有任务完成处理每个抛出的异常.所以我需要做类似的事情:
while (true)
{
try
{
Task.WaitAll(tasks);
break; //only if no exception is occured
}
catch (AggregateException aex)
{
//exceptions handling...
}
}
Run Code Online (Sandbox Code Playgroud)
或者是一些更理性的方式?
| 归档时间: |
|
| 查看次数: |
501 次 |
| 最近记录: |