Assume you have a LINQ query like
source.AsParallel().Where(expensiveOperation).Select(cheapOperation)
I suppose in this case Select
also runs in parallel execution mode. Maybe it's just a cheap operation like i => i*2
, so is there a way to stop parallel execution at a point of querying with chained methods?
(maybe like .AsParallel().Where(expensiveOp).AsSerial?().Select(cheapOp)
?)
Where()
together with theSelect()
. So, even whenSelect()
is cheap, you probably don't need to force it to be sequential. But you'll have to measure that for yourself. – Cissoid