PLINQ – Parallel Linq

Parallel LINQ (PLINQ) enables developers to easily leverage manycore with a minimal impact to existing LINQ programming model

The great thing about PLINQ is that if you are using LINQ-to-objects, there is a very minimal impact to your code in order for it to use PLINQ. All it takes to use PLINQ is adding “.AsParallel()” to your query. This will turn the query into a PLINQ query and will use the PLINQ execution engine when executed.

One small change, and your code now takes advantage of all the hardware available to you.

AsParallel() works by returning an IParallelEnumerable so every subsequent query operator works against the new IParallelEnumerable rather than the normal IEnumerable. For a detailed article on PLINQ, click the below link.