diff options
author | Jb Evain <jbevain@gmail.com> | 2010-03-24 20:42:15 +0300 |
---|---|---|
committer | Jb Evain <jbevain@gmail.com> | 2010-03-24 20:42:15 +0300 |
commit | 200e7a4377ab10bf923a5d63d245b61cb7aebd03 (patch) | |
tree | e55a74631b9bfe114901ae796e1228bd8180b715 | |
parent | 50b69c2387e0ec80afa529f9819e2f1114bee542 (diff) |
2010-03-24 Jb Evain <jbevain@novell.com>
* SortSequenceContext.cs: Fix OrderByDescending stability.
Based on a patch by Richard Kiene <richard.kiene@logos.com>.
backport of r154154.
svn path=/branches/mono-2-6/mcs/; revision=154156
-rw-r--r-- | mcs/class/System.Core/System.Linq/ChangeLog | 7 | ||||
-rw-r--r-- | mcs/class/System.Core/System.Linq/SortSequenceContext.cs | 6 |
2 files changed, 11 insertions, 2 deletions
diff --git a/mcs/class/System.Core/System.Linq/ChangeLog b/mcs/class/System.Core/System.Linq/ChangeLog index 1555443e37f..daff4959c60 100644 --- a/mcs/class/System.Core/System.Linq/ChangeLog +++ b/mcs/class/System.Core/System.Linq/ChangeLog @@ -1,3 +1,10 @@ +2010-03-24 Jb Evain <jbevain@novell.com> + + * SortSequenceContext.cs: Fix OrderByDescending stability. + Based on a patch by Richard Kiene <richard.kiene@logos.com>. + + backport of r154154. + 2009-11-14 Jb Evain <jbevain@novell.com> * QueryableTransformer: adjust to latest ExpressionTransformer diff --git a/mcs/class/System.Core/System.Linq/SortSequenceContext.cs b/mcs/class/System.Core/System.Linq/SortSequenceContext.cs index 2ec42114a41..a29996b9f33 100644 --- a/mcs/class/System.Core/System.Linq/SortSequenceContext.cs +++ b/mcs/class/System.Core/System.Linq/SortSequenceContext.cs @@ -62,8 +62,10 @@ namespace System.Linq { if (comparison == 0) { if (child_context != null) return child_context.Compare (first_index, second_index); - else - comparison = first_index - second_index; + + comparison = direction === SortDirection.Descending + ? second_index - first_index + : first_index - second_index; } return direction == SortDirection.Descending ? -comparison : comparison; |