Parallels .NET

When to use a Parallel.ForEach loop instead of a regular foreach?

Foreach loop:

  • Iterations process sequentially one by one thread.
  • foreach loop is run from a single Thread.
  • foreach loop is defined in every framework of NET.
  • Execution is slower. If single iterations are fast.


  • Execution takes place in a parallel way.
  • Parallel.ForEach uses multiple Threads.
  • Parallel.ForEach is defined in .Net 4.0 and above frameworks.
  • Execution is faster. If single iterations are slow.