In PLINQ, what is the difference between .AsSequen

2019-04-04 00:34发布

I can't seem to wrap my head around what the difference is between AsSequential and AsOrdered. I have looked up documentation on msdn for each of these as well as searching the internet for examples, but I am just a simple shoe cobbler and I was unable to definitively understand what is going on. If possible, could someone please explain when you would use AsSequential vs AsOrdered, and if necessary explain how the results would be different?

标签: c# plinq
1条回答
兄弟一词,经得起流年.
2楼-- · 2019-04-04 01:23

AsOrdered instructs the Parallel LINQ engine to preserve ordering, but still executes the query in parallel. This has the effect of hindering performance as the engine must carefully merge the results after parallel execution.

AsSequential instructs the Parallel LINQ engine to execute the query sequentially, that is, not in parallel.

查看更多
登录 后发表回答