Get result from Task.WhenAll

后端 未结 2 1632

I have multiple tasks returning the same object type that I want to call using Task.WhenAll(new[]{t1,t2,t3}); and read the results.

When I try using <

2条回答
  •  暖寄归人
    2021-01-17 11:39

    Looks like you are using the overload of WaitAll() that doesn't return a value. If you make the following changes, it should work.

    List[] all = await Task.WhenAll(new Task>[] { t, t2 })
                                   .ConfigureAwait(false);
    

自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题