In the previous examples, we called the Task.Result property to get a result from a completed task. This blocks the calling thread until a result is available. TPL provides another way for us to wait on one or more tasks.
There are various APIs available in TPL so that we can wait on one or more tasks. These are as follows:
- Task.Wait
- Task.WaitAll
- Task.WaitAny
- Task.WhenAll
- Task.WhenAny
These APIs will be defined in the following subsections.