Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJb Evain <jbevain@gmail.com>2009-01-22 19:01:36 +0300
committerJb Evain <jbevain@gmail.com>2009-01-22 19:01:36 +0300
commit632d0de0e03581f2b3adb605e43af81a8667af54 (patch)
treec71d917ef6d3b46a878c97662c14ae5f50a38eb3 /mcs/class/System.Core/System.Linq/SortSequenceContext.cs
parentcdff98a470b8953b334497f6f30b92df8264f3b7 (diff)
2009-01-22 Jb Evain <jbevain@novell.com>
* SortSequenceContext.cs: make sort stable. svn path=/trunk/mcs/; revision=124220
Diffstat (limited to 'mcs/class/System.Core/System.Linq/SortSequenceContext.cs')
-rw-r--r--mcs/class/System.Core/System.Linq/SortSequenceContext.cs8
1 files changed, 6 insertions, 2 deletions
diff --git a/mcs/class/System.Core/System.Linq/SortSequenceContext.cs b/mcs/class/System.Core/System.Linq/SortSequenceContext.cs
index 78e08853e6d..2ec42114a41 100644
--- a/mcs/class/System.Core/System.Linq/SortSequenceContext.cs
+++ b/mcs/class/System.Core/System.Linq/SortSequenceContext.cs
@@ -59,8 +59,12 @@ namespace System.Linq {
{
int comparison = comparer.Compare (keys [first_index], keys [second_index]);
- if (comparison == 0 && child_context != null)
- return child_context.Compare (first_index, second_index);
+ if (comparison == 0) {
+ if (child_context != null)
+ return child_context.Compare (first_index, second_index);
+ else
+ comparison = first_index - second_index;
+ }
return direction == SortDirection.Descending ? -comparison : comparison;
}