public static IOrderedEnumerable <T> ThenByPosition <T, TKey>(this IOrderedEnumerable <T> source, Func <T, TKey> keySelector, IEnumerable <TKey> orderedKeys) { PositionalComparer <TKey> comparer = new PositionalComparer <TKey>(orderedKeys.EmptyIfNull()); return(source.ThenBy(keySelector, comparer)); }
public static IOrderedEnumerable <T> OrderByPosition <T, TKey>(this IEnumerable <T> source, Func <T, TKey> keySelector, IEnumerable <TKey> orderedKeys, IComparer <TKey> alternateComparer) { PositionalComparer <TKey> comparer = new PositionalComparer <TKey>(orderedKeys.EmptyIfNull(), alternateComparer); return(source.OrderBy(keySelector, comparer)); }