Method Rank
View SourceRank<TSource>(IAsyncEnumerable<TSource>)
Ranks each item in the sequence in ascending order using a default comparer. The rank is equal to index + 1 of the first element of the item's equality set.
Declaration
public static IAsyncEnumerable<(TSource item, int rank)> Rank<TSource>(this IAsyncEnumerable<TSource> source)
Parameters
Type | Name | Description |
---|---|---|
IAsyncEnumerable<TSource> | source | The sequence whose items will be ranked |
Returns
Type | Description |
---|---|
IAsyncEnumerable<(TSource item, int rank)> | A sorted sequence of items and their rank. |
Type Parameters
Name | Description |
---|---|
TSource | Type of item in the sequence |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
Rank<TSource>(IAsyncEnumerable<TSource>, IComparer<TSource>)
Ranks each item in the sequence in ascending order 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 IAsyncEnumerable<(TSource item, int rank)> Rank<TSource>(this IAsyncEnumerable<TSource> source, IComparer<TSource> comparer)
Parameters
Type | Name | Description |
---|---|---|
IAsyncEnumerable<TSource> | source | The sequence of items to rank |
IComparer<TSource> | comparer | A object that defines comparison semantics for the elements in the sequence |
Returns
Type | Description |
---|---|
IAsyncEnumerable<(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 |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
Rank<TSource>(IAsyncEnumerable<TSource>, OrderByDirection)
Ranks each item in the sequence in the order defined by sortDirection
using a default comparer. The rank is equal to index + 1 of the first element of the item's equality set.
Declaration
public static IAsyncEnumerable<(TSource item, int rank)> Rank<TSource>(this IAsyncEnumerable<TSource> source, OrderByDirection sortDirection)
Parameters
Type | Name | Description |
---|---|---|
IAsyncEnumerable<TSource> | source | The sequence whose items will be ranked |
OrderByDirection | sortDirection | Defines the ordering direction for the sequence |
Returns
Type | Description |
---|---|
IAsyncEnumerable<(TSource item, int rank)> | A sorted sequence of items and their rank. |
Type Parameters
Name | Description |
---|---|
TSource | Type of item in the sequence |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
Rank<TSource>(IAsyncEnumerable<TSource>, IComparer<TSource>, OrderByDirection)
Ranks each item in the sequence in the order defined by sortDirection
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 IAsyncEnumerable<(TSource item, int rank)> Rank<TSource>(this IAsyncEnumerable<TSource> source, IComparer<TSource> comparer, OrderByDirection sortDirection)
Parameters
Type | Name | Description |
---|---|---|
IAsyncEnumerable<TSource> | source | The sequence of items to rank |
IComparer<TSource> | comparer | A object that defines comparison semantics for the elements in the sequence |
OrderByDirection | sortDirection | Defines the ordering direction for the sequence |
Returns
Type | Description |
---|---|
IAsyncEnumerable<(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 |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|