SuperLinq SuperLinq
SuperLinq SuperLinq
DocFX + Singulink = ♥

Search Results for

    Method PartialSortBy

    PartialSortBy<TSource, TKey>(IAsyncEnumerable<TSource>, int, Func<TSource, TKey>)

    Executes a partial sort of the top count elements of a sequence according to the key for each element. If count is less than the total number of elements in source, then this method will improve performance.

    Declaration
    public static IAsyncEnumerable<TSource> PartialSortBy<TSource, TKey>(this IAsyncEnumerable<TSource> source, int count, Func<TSource, TKey> keySelector)
    Parameters
    Type Name Description
    IAsyncEnumerable<TSource> source

    The source sequence.

    int count

    Number of (maximum) elements to return.

    Func<TSource, TKey> keySelector

    A function to extract a key from an element.

    Returns
    Type Description
    IAsyncEnumerable<TSource>

    A sequence containing at most top count elements from source, in ascending order of their keys.

    Type Parameters
    Name Description
    TSource

    Type of elements in the sequence.

    TKey

    Type of keys.

    Remarks

    This operation is an O(n * log(K)) where K is count.

    This operator uses deferred execution and streams it results.

    Exceptions
    Type Condition
    ArgumentNullException

    source is null.

    ArgumentNullException

    keySelector is null.

    ArgumentOutOfRangeException

    count is less than 1.

    PartialSortBy<TSource, TKey>(IAsyncEnumerable<TSource>, int, Func<TSource, TKey>, OrderByDirection)

    Executes a direction partial sort of the top count elements of a sequence according to the key for each element. If count is less than the total number of elements in source, then this method will improve performance.

    Declaration
    public static IAsyncEnumerable<TSource> PartialSortBy<TSource, TKey>(this IAsyncEnumerable<TSource> source, int count, Func<TSource, TKey> keySelector, OrderByDirection direction)
    Parameters
    Type Name Description
    IAsyncEnumerable<TSource> source

    The source sequence.

    int count

    Number of (maximum) elements to return.

    Func<TSource, TKey> keySelector

    A function to extract a key from an element.

    OrderByDirection direction

    The direction in which to sort the elements

    Returns
    Type Description
    IAsyncEnumerable<TSource>

    A sequence containing at most top count elements from source, in the specified order of their keys.

    Type Parameters
    Name Description
    TSource

    Type of elements in the sequence.

    TKey

    Type of keys.

    Remarks

    This operation is an O(n * log(K)) where K is count.

    This operator uses deferred execution and streams it results.

    Exceptions
    Type Condition
    ArgumentNullException

    source is null.

    ArgumentNullException

    keySelector is null.

    ArgumentOutOfRangeException

    count is less than 1.

    PartialSortBy<TSource, TKey>(IAsyncEnumerable<TSource>, int, Func<TSource, TKey>, IComparer<TKey>?)

    Executes a partial sort of the top count elements of a sequence according to the key for each element, using comparer to compare the keys. If count is less than the total number of elements in source, then this method will improve performance.

    Declaration
    public static IAsyncEnumerable<TSource> PartialSortBy<TSource, TKey>(this IAsyncEnumerable<TSource> source, int count, Func<TSource, TKey> keySelector, IComparer<TKey>? comparer)
    Parameters
    Type Name Description
    IAsyncEnumerable<TSource> source

    The source sequence.

    int count

    Number of (maximum) elements to return.

    Func<TSource, TKey> keySelector

    A function to extract a key from an element.

    IComparer<TKey> comparer

    A IComparer<T> to compare elements.

    Returns
    Type Description
    IAsyncEnumerable<TSource>

    A sequence containing at most top count elements from source, in ascending order of their keys.

    Type Parameters
    Name Description
    TSource

    Type of elements in the sequence.

    TKey

    Type of keys.

    Remarks

    This operation is an O(n * log(K)) where K is count.

    This operator uses deferred execution and streams it results.

    Exceptions
    Type Condition
    ArgumentNullException

    source is null.

    ArgumentNullException

    keySelector is null.

    ArgumentOutOfRangeException

    count is less than 1.

    PartialSortBy<TSource, TKey>(IAsyncEnumerable<TSource>, int, Func<TSource, TKey>, IComparer<TKey>?, OrderByDirection)

    Executes a direction partial sort of the top count elements of a sequence according to the key for each element, using comparer to compare the keys. If count is less than the total number of elements in source, then this method will improve performance.

    Declaration
    public static IAsyncEnumerable<TSource> PartialSortBy<TSource, TKey>(this IAsyncEnumerable<TSource> source, int count, Func<TSource, TKey> keySelector, IComparer<TKey>? comparer, OrderByDirection direction)
    Parameters
    Type Name Description
    IAsyncEnumerable<TSource> source

    The source sequence.

    int count

    Number of (maximum) elements to return.

    Func<TSource, TKey> keySelector

    A function to extract a key from an element.

    IComparer<TKey> comparer

    A IComparer<T> to compare elements.

    OrderByDirection direction

    The direction in which to sort the elements

    Returns
    Type Description
    IAsyncEnumerable<TSource>

    A sequence containing at most top count elements from source, in the specified order of their keys.

    Type Parameters
    Name Description
    TSource

    Type of elements in the sequence.

    TKey

    Type of keys.

    Remarks

    This operation is an O(n * log(K)) where K is count.

    This operator uses deferred execution and streams it results.

    Exceptions
    Type Condition
    ArgumentNullException

    source is null.

    ArgumentNullException

    keySelector is null.

    ArgumentOutOfRangeException

    count is less than 1.

    © SuperLinq Authors. All rights reserved.