我目前正在阅读 Pro LINQ c# 2008,在第 87 页有人说 OrderBy 和 OrderByDescending 是稳定的。但他在第 96 页说的恰恰相反。在我看来,他指的是完全相同的功能,所以我不明白。他们是stable or not ?
最佳答案
是的,它们绝对稳定。我在 my review 中发现了同样的错误的书。
Joe 回应了我的评论:
Just for your reader's knowledge, the ordering is now specified to be stable. Initially it was unstable, and was later changed to be stable but I was told it would be specified to be unstable, but apparently at some point, the specification was changed to be stable. My book was updated but apparently I missed a spot.
所以是的,这是一个错误。
总的来说,这是一本相当准确的书。 (有一些不准确的地方是由于 MSDN 不准确造成的,但这很容易被原谅。)周围远更糟:)
关于c# - OrderBy 和 OrderByDescending 是否稳定?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1209935/