When To Use Parallel.ForEach and When to Use PLINQ

Igor Ostrovsky - MSFT

If you’ve played around with PLINQ and Parallel.ForEach loops in .NET 4, you may have noticed that many PLINQ queries can be rewritten as parallel loops, and also many parallel loops can be rewritten as PLINQ queries. However, both parallel loops and PLINQ have distinct advantages in different situations. When writing parallel code, it helps to understand these differences to appropriately decide between the two models.

Pamela Vagata wrote an interesting comparison of parallel loops and PLINQ: When Should I Use Parallel.ForEach? When Should I Use PLINQ?

0 comments

Discussion is closed.

Feedback usabilla icon