Introducing PLINQ
PLINQ is a set of .NET extensions for LINQ that allow part of the LINQ query to execute in parallel by leveraging the thread pool. The PLINQ implementation provides parallel versions of all of the available LINQ query operations.
Like LINQ queries, PLINQ queries offer deferred execution. This means that the objects are not queried until they need to be enumerated. If you aren’t familiar with LINQ’s deferred execution, we will look at a simple example to illustrate the concept. Consider these two LINQ queries:
internal void QueryCities(List<string> cities)
{
// Query is executed with ToList call
List<string> citiesWithS = cities.Where(s =>
s.StartsWith('S')).ToList();
// Query is not executed here
IEnumerable<string> citiesWithT = cities.Where(s =>...