Introducing Parallel LINQ

Parallel LINQ, also known as PLINQ, is a special LINQ implementation provided by .NET Framework 4.6 that enables developers to query data using the LINQ syntax but uses multicore and multiprocessor architectures that have support by the Task Parallel Library. Creating “parallel” queries is an easy task, although there are some architectural differences with classic LINQ (or more with classic programming). These are discussed during this chapter. To create a parallel query, you just need to invoke the AsParallel extension method onto the data source you are querying. The following code provides an example:

Dim range = Enumerable.Range(0, 1000)'Just add "AsParallel"Dim query = From num In ...

Get Visual Basic 2015 Unleashed 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.