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 static IOrderedEnumerable <TSource> OrderBy <TSource, TKey>( this IEnumerable <TSource> source, Func <TSource, TKey> keySelector, IComparer <TKey> keyComparer) { EnsureArgumentIsNotNull(source, nameof(source)); EnsureArgumentIsNotNull(keySelector, nameof(keySelector)); var myComparer = new MyComparer <TSource, TKey>(keySelector, keyComparer); var comparersList = new List <IComparer <TSource> >(); comparersList.Add(myComparer); return(new MyOrderedEnumerable <TSource>(source, comparersList)); }