May 2010
Intermediate to advanced
1272 pages
61h 18m
English
To create a parallel query, you simply need to invoke the AsParallel extension method for the data source you want to query. Copy the method shown in the previous paragraph and rename it as PLinqQuery; then simply change the first line of the query as follows:
Dim query = From num In range.AsParallel
Different from a LINQ query, AsParallel returns a ParallelQuery(Of T) that is exposed by the System.Linq namespace and that is specific for PLINQ, although it works as an IEnumerable(Of T) but it allows scaling data over multicore processors. Now edit Sub Main so that it invokes the PLinqQuery method and runs the code again. Figure 29.2 shows what you should see when the application is processing data.
Figure ...
Read now
Unlock full access