public override int Compare(int firstIndex, int secondIndex)
        {
            var comparison = _comparer.Compare(_keys[firstIndex], _keys[secondIndex]);

            if (comparison == 0)
            {
                if (ChildContext != null)
                {
                    return(ChildContext.Compare(firstIndex, secondIndex));
                }
                comparison = Direction == SortDirection.Descending
                             ? secondIndex - firstIndex
                             : firstIndex - secondIndex;
            }
            return(Direction == SortDirection.Descending ? -comparison : comparison);
        }
Ejemplo n.º 2
0
        internal override int Compare(int firstIndex, int secondIndex)
        {
            int comparison = comparer.Compare(keys[firstIndex], keys[secondIndex]);

            if (comparison == 0)
            {
                if (ChildContext != null)
                {
                    return(ChildContext.Compare(firstIndex, secondIndex));
                }

                comparison = descending ? secondIndex - firstIndex : firstIndex - secondIndex;
            }

            return(descending ? -comparison : comparison);
        }