The msdn documentation about order preservation in PLINQ states the following about ForAll().
- Result when the source sequence is ordered: Executes nondeterministically in parallel
- Result when the source sequence is unordered: Executes nondeterministically in parallel
Does this mean that ordered execution of the ForAll method is never guaranteed?
I haven't used PLINQ before, but the following Code Review question seemed like an appropriate usage for it. At the bottom of my answer I write:
Events.AsParallel().AsOrdered().ForAll( eventItem =>
{
...
} );
After reading the documentation I believe the AsOrdered() wouldn't change anything?
I'm also suspecting the previous query can't replace a simple for loop where order is important?
Probably parallel calls to the StringBuilder will also occur, resulting in a wrong output?