Difference between await Task and await Task.WhenAll

后端 未结 4 651
被撕碎了的回忆
被撕碎了的回忆 2020-12-22 03:48

What is the difference when using await on multiple await task vs waiting on all the tasks to finish. My under standing is the scenario 2 is better in terms of

4条回答
  •  粉色の甜心
    2020-12-22 04:32

    In the first scenario you launch a task and then wait until is completed, then pass to the second one and wait until finish before exit from the method.
    In the second scenario you launch the two task in parallel and then wait until tgey are completed when you call Task.WhenAll

提交回复
热议问题