private static IOrderedAsyncEnumerable <TSource> ThenByDescendingAwaitWithCancellationCore <TSource, TKey>(this IOrderedAsyncEnumerable <TSource> source, Func <TSource, CancellationToken, ValueTask <TKey> > keySelector, IComparer <TKey> comparer) { if (source == null) { throw Error.ArgumentNull(nameof(source)); } return(source.CreateOrderedEnumerable(keySelector, comparer, descending: true)); }
/// <summary> /// Performs a subsequent ordering of the elements in a sequence in descending order by using a specified comparer. /// </summary> /// <typeparam name="TSource">The type of the elements of source.</typeparam> /// <typeparam name="TKey">The type of the key returned by keySelector.</typeparam> /// <param name="source">An ordered async-enumerable sequence that contains elements to sort.</param> /// <param name="keySelector">A function to extract a key from each element.</param> /// <param name="comparer">A comparer to compare keys.</param> /// <returns>An ordered async-enumerable sequence whose elements are sorted in descending order according to a key.</returns> /// <exception cref="ArgumentNullException"><paramref name="source"/> or <paramref name="keySelector"/> is null.</exception> public static IOrderedAsyncEnumerable <TSource> ThenByDescending <TSource, TKey>(this IOrderedAsyncEnumerable <TSource> source, Func <TSource, TKey> keySelector, IComparer <TKey> comparer) { if (source == null) { throw Error.ArgumentNull(nameof(source)); } return(source.CreateOrderedEnumerable(keySelector, comparer, descending: true)); }
private static IOrderedAsyncEnumerable <TSource> ThenByDescendingAwaitCore <TSource, TKey>(this IOrderedAsyncEnumerable <TSource> source, Func <TSource, ValueTask <TKey> > keySelector) { if (source == null) { throw Error.ArgumentNull(nameof(source)); } return(source.CreateOrderedEnumerable(keySelector, comparer: default(IComparer <TKey>), descending: true)); }
internal static IOrderedAsyncEnumerable <TSource> ThenByAwaitCore <TSource, TKey>(this IOrderedAsyncEnumerable <TSource> source, Func <TSource, ValueTask <TKey> > keySelector, IComparer <TKey> comparer) { if (source == null) { throw Error.ArgumentNull(nameof(source)); } return(source.CreateOrderedEnumerable(keySelector, comparer, descending: false)); }
/// <summary> /// Sort a sequence in ascending order, based on a particular key /// </summary> /// <typeparam name="TSource">The type of elements in the sequence</typeparam> /// <typeparam name="TKey">The type of key</typeparam> /// <param name="source">The sequence of elements</param> /// <param name="keySelector">The function to extract a key value from an element</param> /// <returns>The sorted sequence</returns> public static IOrderedAsyncEnumerable <TSource> ThenByDescending <TSource, TKey>( this IOrderedAsyncEnumerable <TSource> source, Func <TSource, ValueTask <TKey> > keySelector) { if (source == null) { throw new ArgumentNullException(nameof(source)); } if (keySelector == null) { throw new ArgumentNullException(nameof(keySelector)); } return(source.CreateOrderedEnumerable(keySelector, null, true)); }
/// <summary> /// Sort a sequence in ascending order, based on a particular key /// </summary> /// <typeparam name="TSource">The type of elements in the sequence</typeparam> /// <typeparam name="TKey">The type of key</typeparam> /// <param name="source">The sequence of elements</param> /// <param name="keySelector">The function to extract a key value from an element</param> /// <param name="comparer">The function to use to compare keys</param> /// <returns>The sorted sequence</returns> public static IOrderedAsyncEnumerable <TSource> ThenBy <TSource, TKey>( this IOrderedAsyncEnumerable <TSource> source, Func <TSource, ValueTask <TKey> > keySelector, IComparer <TKey> comparer) { if (source == null) { throw new ArgumentNullException(nameof(source)); } if (keySelector == null) { throw new ArgumentNullException(nameof(keySelector)); } return(source.CreateOrderedEnumerable(keySelector, comparer, false)); }
private static IOrderedAsyncEnumerable <TValue> ThenByCore <TKey, TValue>(IOrderedAsyncEnumerable <TValue> enumerable, Func <TValue, Task <TKey> > keySelector, IComparer <TKey> comparer, bool descending) { if (enumerable == null) { throw new ArgumentNullException("enumerable"); } if (keySelector == null) { throw new ArgumentNullException("keySelector"); } if (comparer == null) { throw new ArgumentNullException("comparer"); } return(enumerable.CreateOrderedEnumerable(keySelector, comparer, descending)); }