Using ParallelEnumerable
The System.Linq
namespace for .NET 4.0 introduces a new ParallelEnumerable
class, which is the parallel counterpart of Enumerable
and provides extension methods specific to parallelism, such as AsParallel
. You can use ParallelEnumerable
members instead of invoking AsParallel
because both return a ParallelQuery(Of T)
. For example the PLINQ query in the first example could be rewritten as follows:
In this case the range variable is of type ParallelEnumerable(Of Integer)
, and therefore you do not need to invoke AsParallel
. By the way, there are some differences in how data is handled, and this may often lead AsParallel
to ...
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.