Parallel.Invoke allows us to execute tasks in (you guessed it) parallel. Sometimes, you need to perform operations simultaneously and, in so doing, speed up the processing. You can, therefore, expect that the total time taken to process the tasks is equal to the longest running process. Using Parallel.Invoke is quite easy.
Invoking parallel calls to methods using Parallel.Invoke
Getting ready
Make sure that you've added the using System.Threading.Tasks; statement to the top of your Demo class.
How to do it...
- Start off by creating two methods in the Demo class called ParallelInvoke() and PerformSomeTask() that...