public IOrderedEnumerable <T> CreateOrderedEnumerable <TKey>(Func <T, TKey> keySelector, IComparer <TKey> keyComparer, bool descending) { var secondComparer = new MyComparer <T, TKey>(keySelector, keyComparer); Comparers.Add(secondComparer); return(new MyOrderedEnumerable <T>(this, Comparers)); }
public ChainComparer(IEnumerable <IComparer <T> > comparers, IEnumerable <IEqualityComparer <T> > equalityComparers) { if (comparers != null) { foreach (IComparer <T> comparer in comparers.Where(e => e != null)) { Comparers.Add(comparer); } } if (equalityComparers != null) { foreach (IEqualityComparer <T> equalityComparer in equalityComparers.Where(e => e != null)) { EqualityComparers.Add(equalityComparer); } } }
public MultiStepComparer(IComparer <T> primaryComparer, params IComparer <T>[] secondaryComparers) { Comparers.Add(primaryComparer); Comparers.AddRange(secondaryComparers); }
public MultiStepComparer(IComparer <T> primaryComparer, IEnumerable <IComparer <T> > secondaryComparers) { Comparers.Add(primaryComparer); Comparers.AddRange(secondaryComparers); }