Click or drag to resize

XEnumerableDenseRankByDescendingTSource, TKey, TResult Method

Associates a descending dense 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
Syntax
public static IEnumerable<TResult> DenseRankByDescending<TSource, TKey, TResult>(
	this IEnumerable<TSource> source,
	Func<TSource, TKey> keySelector,
	Func<TSource, int, TResult> resultSelector,
	IComparer<TKey>? keyComparer = null
)

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: IEnumerableTResult
A 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