ThenByDescending(TSource, TKey) Method (OrderedParallelQuery(TSource), Func(TSource, TKey))

Task Parallel System.Threading

Performs in parallel a subsequent ordering of the elements in a sequence in descending order, according to a key.

Namespace:  System.Linq
Assembly:  System.Threading (in System.Threading.dll)

Syntax

Visual Basic (Declaration)
Public Shared Function ThenByDescending(Of TSource, TKey) ( _
	source As OrderedParallelQuery(Of TSource), _
	keySelector As Func(Of TSource, TKey) _
) As OrderedParallelQuery(Of TSource)
C#
public static OrderedParallelQuery<TSource> ThenByDescending<TSource, TKey>(
	OrderedParallelQuery<TSource> source,
	Func<TSource, TKey> keySelector
)

Parameters

source
Type: System.Linq..::.OrderedParallelQuery<(Of <(TSource>)>)
An OrderedParallelQuery{TSource} than contains elements to sort.
keySelector
Type: System..::.Func<(Of <(TSource, TKey>)>)
A function to extract a key from an element.

Type Parameters

TSource
The type of elements of source.
TKey
The type of the key returned by keySelector.

Return Value

An OrderedParallelQuery{TSource} whose elements are sorted descending according to a key.

Remarks

In contrast to the sequential implementation, this is not a stable sort. See the remarks for OrderBy(ParallelQuery{TSource}, Func{TSource,TKey}) for an approach to implementing a stable sort.

Exceptions

ExceptionCondition
System..::.ArgumentNullException source or keySelector is a null reference (Nothing in Visual Basic).

See Also