July 2015
Intermediate to advanced
1300 pages
87h 27m
English
The Task class has other interesting usages, such as managing concurrent operations. This is possible because of two methods, Task.WhenAll and Task.WhenAny, also known as combinators. Task.WhenAll creates a task that will complete when all the supplied tasks complete; Task.WhenAny creates a task that will complete when at least one of the supplied tasks completes. For example, imagine you want to download multiple RSS feeds information from a website. Instead of using Await against individual tasks to complete, you can use Task.WhenAll to continue only after all tasks have completed. The following code provides an example of concurrent download of RSS feeds from the Microsoft Channel 9 feed used previously: