XEnumerableRankByDescendingTSource, TKey, TResult Method |
Associates a descending rank to each element of the input sequence, based on the specified key and key comparer.
Namespace:
Linq.Extras
Assembly:
Linq.Extras (in Linq.Extras.dll) Version: 5.0.0+96a4f4bfed64095342c5df107c1fe1fb95603ee5
Syntaxpublic static IEnumerable<TResult> RankByDescending<TSource, TKey, TResult>(
this IEnumerable<TSource> source,
Func<TSource, TKey> keySelector,
Func<TSource, int, TResult> resultSelector,
IComparer<TKey>? keyComparer = null
)
<ExtensionAttribute>
Public Shared Function RankByDescending(Of TSource, TKey, TResult) (
source As IEnumerable(Of TSource),
keySelector As Func(Of TSource, TKey),
resultSelector As Func(Of TSource, Integer, TResult),
Optional keyComparer As IComparer(Of TKey) = Nothing
) As IEnumerable(Of TResult)
[<ExtensionAttribute>]
static member RankByDescending :
source : IEnumerable<'TSource> *
keySelector : Func<'TSource, 'TKey> *
resultSelector : Func<'TSource, int, 'TResult> *
?keyComparer : IComparer<'TKey>
(* Defaults:
let _keyComparer = defaultArg keyComparer null
*)
-> IEnumerable<'TResult>
Parameters
- source
- Type: System.Collections.GenericIEnumerableTSource
The input sequence. - keySelector
- Type: SystemFuncTSource, TKey
A function that returns the key for each element. - resultSelector
- Type: SystemFuncTSource, Int32, TResult
A projection that takes an element and its rank and returns an output element. - keyComparer (Optional)
- Type: System.Collections.GenericIComparerTKey
The comparer used to compare the keys.
Type Parameters
- TSource
- The type of the elements of source.
- TKey
- The type of the key used to compare elements.
- TResult
- The type of the elements in the output sequence.
Return Value
Type:
IEnumerableTResultA sequence of elements associated with their rank using the result selector.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
IEnumerableTSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
Remarks
See Also