[Mono-dev] Bug 582502 - System.Linq.Enumerable.OrderByDescending is not a stable sort

Richard Kiene richard.kiene at logos.com
Wed Mar 24 13:18:49 EDT 2010


Well by definition a stable sort preserves the order of the collection for equal elements, but I get what you're saying. After reading what you've said, it would appear that what needs to happen is second_index - first_index in the case of descending and first_index - second_index in the case of ascending. It looks like the sort was made stable for OrderBy but not OrderByDescending.

I've attached a patch which I release under the MIT/X11 license.

Richard Kiene
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: OrderByDescendingPatch.txt
Url: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20100324/adf05951/attachment.txt 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: ATT00001..txt
Url: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20100324/adf05951/attachment-0001.txt 


More information about the Mono-devel-list mailing list