views:

780

answers:

2

I am currently reading Pro LINQ c# 2008, and in page 87 the guy says OrderBy and OrderByDescending are stable. But he says exactly the opposite in page 96. It looks to me as he is referring to exactly the same functions, so I don't get it. Are they stable or not?

+6  A: 

Yes, they're definitely stable. I picked up the same error in my review of the book.

Joe responded to that bit of my review with this:

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.

So yes, it was a mistake.

Overall it's a reasonably accurate book. (There are a few inaccuracies which are due to MSDN being inaccurate, but that's fairly easy to forgive.) There are far worse around :)

Jon Skeet
Ah, so funny. Now that I stalked your website I saw you wrote c# in depth, which I am reading too :P
devoured elysium
If you find any similar mistakes in that, please do let me know :) Unfortunately the errata page on the web site isn't working at the moment, so you can't check whether I already know...
Jon Skeet
Will there ever be a More C# In Depth? :)
Abhijeet Patel
Well I'm working on the second edition :) http://manning.com/skeet2
Jon Skeet
A: 

According to MSDN, OrderBy is stable, as is OrderByDescending.

Adam Robinson