Parallel Class
Learn to invoke methods and iterate loops in parallel.
We'll cover the following...
Overview
The core of the TPL is the Task
class, but developers interested in parallelizing some jobs in their apps must also consider the Parallel
class (also part of the TPL).
The Parallel
class is static and allows us to execute code in parallel. Similar to a method running as part of a Task
instance, the Parallel
class uses pool threads to achieve parallelism and asynchronous execution. The Parallel
class gives us several options:
Invoke()
: This method accepts an array ofAction
delegates, either in the form of an array or as separate parameters. Methods passed in execute in parallel.For()
: This method