To understand PLINQ queries, we need to understand the ParallelEnumerable class first. Once we have an understanding of the ParallelEnumerable class, we will learn how to write parallel queries.
Writing PLINQ queries
Introducing the ParallelEnumerable class
The ParallelEnumerable class is available in the System.Linq namespace and the System.Core assembly.
Apart from supporting most of the standard query operators defined by LINQ, the ParallelEnumerable class supports a lot of extra methods that support parallel execution:
- AsParallel(): This is the seed method that's required for parallelization.
- AsSequential(): Enables sequential execution of a parallel query by changing the parallel behavior.
- AsOrdered(): By default...