5.6. Parallel LINQ

PLINQ is the parallelized version of LINQ to Objects and supports all existing LINQ operators and functionality with a few new options for fine-grained control of parallelization functionality.

At the time of writing, LINQ to SQL and LINQ to Entities will not benefit from parallelization because in these cases the query is executed on the database or the provider, so .NET cannot parallelize it.

5.6.1. Why Not Parallelize All LINQ Queries Automatically?

Parallelizing LINQ queries automatically is potentially the ultimate goal for LINQ, but it can introduce some issues (particularly around ordering), so at present you have to opt in to the parallel model.

A WORD OF WARNING

When using PLINQ, it is important to ensure that your ...

Get Introducing .NET 4.0: with Visual Studio 2010 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.