In the MSDN magazine article,
Stephen Toub explains the use of parallel tasks like PLINQ in .Net 4.0. I recommend reading this article to get some insights on parallel operations whether you use them or not in your applications.
With the Parallel class, you can parallelize it simply as follows:
- Parallel.For(0, N, i => {
- … // Process i here
- });
Here, the developer is still responsible for ensuring each iteration of the loop is in fact independent, but beyond that, the Parallel.For construct handles all aspects of this loop’s parallelization.
Stephen Toub is a principal architect on the Parallel Computing Platform team at Microsoft.