AsParallel and Binary Operators

There are situations in which you use operators that take two data sources; among such operators, there are the following binary operators: Join, GroupJoin, Except, Concat, Intersect, Union, Zip, and SequenceEqual. To take advantage of parallelism with binary operators on two data sources, you need to invoke AsParallel on both collections, as demonstrated by the following code:

Dim result = firstSource.AsParallel.Except(secondSource.AsParallel)

The following code still works but it won’t take advantage of parallelism:

Dim result = firstSource.AsParallel.Except(secondSource)

Get Visual Basic® 2010 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.