December 2019
Intermediate to advanced
346 pages
9h 8m
English
This is a static method that is defined in the Task class and used to wait on multiple tasks. The tasks are passed as an array to the method and the caller is blocked until all the tasks are completed. This method also supports timeout and cancellation tokens. Some example code that uses this method is as follows:
Task taskA = Task.Factory.StartNew(() => Console.WriteLine("TaskA finished")); Task taskB = Task.Factory.StartNew(() => Console.WriteLine("TaskB finished")); Task.WaitAll(taskA, taskB); Console.WriteLine("Calling method finishes");
The output of the preceding code is as follows:

As you can see, the Calling method ...
Read now
Unlock full access