コード例 #1
0
        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));
        }
コード例 #2
0
        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));
        }
コード例 #3
0
        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));
        }
コード例 #4
0
 internal KeyedNullPlacementComparer(IComparer <T> comparer, Func <T, TKey> keySelector, NullFilter <TKey> filter)
     : base(comparer, filter)
 {
     _keySelector = keySelector;
 }
コード例 #5
0
 public override int Compare(T x, T y)
 {
     return(NullFilter.Filter(x, y) ?? Comparer.Compare(x, y));
 }
コード例 #6
0
 internal UnkeyedNullPlacementComparer(IComparer <T> comparer, NullFilter <T> filter)
     : base(comparer, filter)
 {
 }
コード例 #7
0
 protected NullPlacementComparer(IComparer <T> comparer, NullFilter <TCompared> filter)
 {
     Comparer   = comparer;
     NullFilter = filter;
 }