Exemplo n.º 1
0
        public IComparer <T> CreateCompoundComparer(IComparer <T> comparer)
        {
            CompoundComparer <T> compoundComparer = new CompoundComparer <T>();

            compoundComparer.AppendComparison(Comparer);
            compoundComparer.AppendComparison(comparer);
            return(KeyedNullPlacementComparer <T, TKey> .GetComparer(compoundComparer.Normalize(), _keySelector, NullFilter.NullsFirst));
        }
Exemplo n.º 2
0
        public static IComparer <T> GetComparer(IComparer <T> baseComparer, IComparer <T> nextComparer)
        {
            // make sure null comparer stays highest precedence
            IPrecedenceEnforcer <T> nullComparer = baseComparer as IPrecedenceEnforcer <T>;

            if (nullComparer != null)
            {
                return(nullComparer.CreateCompoundComparer(nextComparer));
            }
            CompoundComparer <T> comparer = new CompoundComparer <T>();

            comparer.AppendComparison(baseComparer);
            comparer.AppendComparison(nextComparer);
            return(comparer.Normalize());
        }