SuperLinq SuperLinq
SuperLinq SuperLinq
DocFX + Singulink = ♥

Search Results for

    Method RankBy

    RankBy<TSource, TKey>(IEnumerable<TSource>, Func<TSource, TKey>)

    Ranks each item in the sequence in ascending order by a specified key using a default comparer. The rank is equal to index + 1 of the first element of the item's equality set.

    Declaration
    public static IEnumerable<(TSource item, int rank)> RankBy<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
    Parameters
    Type Name Description
    IEnumerable<TSource> source

    The sequence of items to rank

    Func<TSource, TKey> keySelector

    A key selector function which returns the value by which to rank items in the sequence

    Returns
    Type Description
    IEnumerable<(TSource item, int rank)>

    A sorted sequence of items and their rank.

    Type Parameters
    Name Description
    TSource

    The type of the elements in the source sequence

    TKey

    The type of the key used to rank items in the sequence

    Remarks

    This method is implemented by using deferred execution. However, source will be consumed in it's entirety immediately when first element of the returned sequence is consumed.

    Exceptions
    Type Condition
    ArgumentNullException

    source or keySelector is null.

    RankBy<TSource, TKey>(IEnumerable<TSource>, Func<TSource, TKey>, OrderByDirection)

    Ranks each item in the sequence in the order defined by sortDirection by a specified key using a default comparer. The rank is equal to index + 1 of the first element of the item's equality set.

    Declaration
    public static IEnumerable<(TSource item, int rank)> RankBy<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, OrderByDirection sortDirection)
    Parameters
    Type Name Description
    IEnumerable<TSource> source

    The sequence of items to rank

    Func<TSource, TKey> keySelector

    A key selector function which returns the value by which to rank items in the sequence

    OrderByDirection sortDirection

    Defines the ordering direction for the sequence

    Returns
    Type Description
    IEnumerable<(TSource item, int rank)>

    A sorted sequence of items and their rank.

    Type Parameters
    Name Description
    TSource

    The type of the elements in the source sequence

    TKey

    The type of the key used to rank items in the sequence

    Remarks

    This method is implemented by using deferred execution. However, source will be consumed in it's entirety immediately when first element of the returned sequence is consumed.

    Exceptions
    Type Condition
    ArgumentNullException

    source or keySelector is null.

    RankBy<TSource, TKey>(IEnumerable<TSource>, Func<TSource, TKey>, IComparer<TKey>)

    Ranks each item in the sequence in ascending order by a specified key using a caller-supplied comparer. The rank is equal to index + 1 of the first element of the item's equality set.

    Declaration
    public static IEnumerable<(TSource item, int rank)> RankBy<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, IComparer<TKey> comparer)
    Parameters
    Type Name Description
    IEnumerable<TSource> source

    The sequence of items to rank

    Func<TSource, TKey> keySelector

    A key selector function which returns the value by which to rank items in the sequence

    IComparer<TKey> comparer

    An object that defines the comparison semantics for keys used to rank items

    Returns
    Type Description
    IEnumerable<(TSource item, int rank)>

    A sorted sequence of items and their rank.

    Type Parameters
    Name Description
    TSource

    The type of the elements in the source sequence

    TKey

    The type of the key used to rank items in the sequence

    Remarks

    This method is implemented by using deferred execution. However, source will be consumed in it's entirety immediately when first element of the returned sequence is consumed.

    Exceptions
    Type Condition
    ArgumentNullException

    source or keySelector is null.

    RankBy<TSource, TKey>(IEnumerable<TSource>, Func<TSource, TKey>, IComparer<TKey>, OrderByDirection)

    Ranks each item in the sequence in the order defined by sortDirection by a specified key using a caller-supplied comparer. The rank is equal to index + 1 of the first element of the item's equality set.

    Declaration
    public static IEnumerable<(TSource item, int rank)> RankBy<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector, IComparer<TKey> comparer, OrderByDirection sortDirection)
    Parameters
    Type Name Description
    IEnumerable<TSource> source

    The sequence of items to rank

    Func<TSource, TKey> keySelector

    A key selector function which returns the value by which to rank items in the sequence

    IComparer<TKey> comparer

    An object that defines the comparison semantics for keys used to rank items

    OrderByDirection sortDirection

    Defines the ordering direction for the sequence

    Returns
    Type Description
    IEnumerable<(TSource item, int rank)>

    A sorted sequence of items and their rank.

    Type Parameters
    Name Description
    TSource

    The type of the elements in the source sequence

    TKey

    The type of the key used to rank items in the sequence

    Remarks

    This method is implemented by using deferred execution. However, source will be consumed in it's entirety immediately when first element of the returned sequence is consumed.

    Exceptions
    Type Condition
    ArgumentNullException

    source or keySelector is null.

    © SuperLinq Authors. All rights reserved.