await Task.WhenAll() vs Task.WhenAll().Wait()

后端 未结 1 1122
我在风中等你
我在风中等你 2020-12-29 23:49

I have a method that produces an array of tasks (See my previous post about threading) and at the end of this method I have the following options:

await Task         


        
1条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-30 00:17

    await will return to the caller, and resume method execution when the awaited task completes.

    WhenAll will create a task **When All* all the tasks are complete.

    WaitAll will block the creation thread (main thread) until all the tasks are complete.

    0 讨论(0)
提交回复
热议问题