End Sub. Note: Again, the ToList() used to execute the LINQ query immediately rather than waiting for it to execute when the IEnumerable<T> returned by
Note: Again, the ToList() used to execute the LINQ query immediately rather than waiting for it to execute when the IEnumerable<T> returned by Select() is iterated over during the foreach that comes later. You are avoiding Delayed Execution.
3. Build and run the application. 4. You should observe that the LINQ query performs the operations in order of the Employee ID. Also observe the total amount of time required to complete the work (the exact time required will vary): Figure 15 Output from non-parallelized LINQ query with extension methods
5. To parallelize this LINQ query just replace the current method call from Main(), with the following one. C# static void Main(string[] args) { ... // Methods to call
|