As a summary taken from here.

Both approaches work the same way: the initial collection is split up intro smaller chunks (partitions) and the operations are performed on them, in parallel (probably).

Use PLinq when:

  • when there is a need of composition, Linq like constructs are easier to reason about
  • when order is important

Movies.AsParallel().AsOrdered().Select(…)

 

Use Parallel.For(each)

  • the data is simple in nature and the actions are independent
  • when operations need to maintain thread-local state
  • when you need to break out of the iteration; this can be done either by calling the Break or Stop methods on the ParallelLoopState class

 

 

I am more into doing than having, but a clear goal plus a natural tendency to quickly loose focus brings me to where I am … not there, but here, not doing, but starting new stuff and letting it die all the time.

Something needs to change. Training myself to do stuff for personal rewards is the way I’ll do it. While I am not in need of anything in particular, I don’t long for nothing special and I am pretty generally able to resist temptations, I am tempted today to start something and finish it.

Lets see how it goes.

Follow

Get every new post delivered to your Inbox.