Get result from Task.WhenAll

后端 未结 2 1654

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:54

    The return type of WhenAll is a task whose result type is an array of the individual tasks' result type, in your case Task[]>

    When used in an await expression, the task will be "unwrapped" into its result type, meaning that the type of your "all" variable should be List[]

提交回复
热议问题