If I have the following order in an IEnumerable (list) :
1 - 2 - 3 - 4 - 5
and If I run a PLINQ query on this say :
list.AsParallel().AsOrdered().WithDegreeOfParallelism(10).Select(
s => SomeDelegateFunction(s)).AsSequential().ToList();
For the above query I see in my logging (inside delegate function) that it uses multiple threads, but does not maintain the sequence of processing of the list. However for the below query i does maintain the sequence but uses a single thread to do the entire operation:
list.AsParallel().AsOrdered().WithDegreeOfParallelism(10).AsSequential().Select(
s => SomeDelegateFunction(s)).ToList();
The difference between the two queries is the "AsSequential()" in the second query, the question I had is that when I use AsSequential() :
1 - Why does it not use multi threads? It could have broken down the work as :
1 - 2 (Give it to thread 1)
3 - 4 - 5 (Give it to thread 2)
Instead it does do 1 - 2 - 3 - 4 - 5 (In that order) but does it on a single thread - why??
Basically I need to process my list in the ORDER it came into as input but on multiple threads.
Any ideas ?