public override int Compare(T x, T y)
        {
            TKey xKey = _keySelector(x);
            TKey yKey = _keySelector(y);

            return(NullFilter.Filter(xKey, yKey) ?? Comparer.Compare(x, y));
        }
        public static IComparer <T> GetComparer(IComparer <T> comparer, Func <T, TKey> keySelector, bool nullsFirst)
        {
            NullFilter <TKey> filter = NullFilterFactory.GetNullFilter <TKey>(nullsFirst);

            if (filter == null)
            {
                return(comparer);
            }
            return(new KeyedNullPlacementComparer <T, TKey>(comparer, keySelector, filter));
        }
        public static IComparer <T> GetComparer(IComparer <T> comparer, bool nullsFirst)
        {
            NullFilter <T> filter = NullFilterFactory.GetNullFilter <T>(nullsFirst);

            if (filter == null)
            {
                return(comparer);
            }
            return(new UnkeyedNullPlacementComparer <T>(comparer, filter));
        }
 internal KeyedNullPlacementComparer(IComparer <T> comparer, Func <T, TKey> keySelector, NullFilter <TKey> filter)
     : base(comparer, filter)
 {
     _keySelector = keySelector;
 }
 public override int Compare(T x, T y)
 {
     return(NullFilter.Filter(x, y) ?? Comparer.Compare(x, y));
 }
 internal UnkeyedNullPlacementComparer(IComparer <T> comparer, NullFilter <T> filter)
     : base(comparer, filter)
 {
 }
 protected NullPlacementComparer(IComparer <T> comparer, NullFilter <TCompared> filter)
 {
     Comparer   = comparer;
     NullFilter = filter;
 }