WaitAll vs WhenAll

后端 未结 4 1925
夕颜
夕颜 2020-11-22 11:45

What is the difference between Task.WaitAll() and Task.WhenAll() from the Async CTP ? Can you provide some sample code to illustrate the different

4条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-22 12:45

    As an example of the difference -- if you have a task the does something with the UI thread (e.g. a task that represents an animation in a Storyboard) if you Task.WaitAll() then the UI thread is blocked and the UI is never updated. if you use await Task.WhenAll() then the UI thread is not blocked, and the UI will be updated.

提交回复
热议问题