ParallelEnumerable.OrderByDescending 方法

定义

按降序对序列的元素排序。Sorts the elements of a sequence in descending order.

重载

OrderByDescending<TSource,TKey>(ParallelQuery<TSource>, Func<TSource,TKey>)

根据键按降序对序列中的元素进行并行排序。Sorts in parallel the elements of a sequence in descending order according to a key.

OrderByDescending<TSource,TKey>(ParallelQuery<TSource>, Func<TSource,TKey>, IComparer<TKey>)

使用指定的比较器按降序对序列的元素排序。Sorts the elements of a sequence in descending order by using a specified comparer.

OrderByDescending<TSource,TKey>(ParallelQuery<TSource>, Func<TSource,TKey>)

根据键按降序对序列中的元素进行并行排序。Sorts in parallel the elements of a sequence in descending order according to a key.

public:
generic <typename TSource, typename TKey>
[System::Runtime::CompilerServices::Extension]
 static System::Linq::OrderedParallelQuery<TSource> ^ OrderByDescending(System::Linq::ParallelQuery<TSource> ^ source, Func<TSource, TKey> ^ keySelector);
public static System.Linq.OrderedParallelQuery<TSource> OrderByDescending<TSource,TKey> (this System.Linq.ParallelQuery<TSource> source, Func<TSource,TKey> keySelector);
static member OrderByDescending : System.Linq.ParallelQuery<'Source> * Func<'Source, 'Key> -> System.Linq.OrderedParallelQuery<'Source>
<Extension()>
Public Function OrderByDescending(Of TSource, TKey) (source As ParallelQuery(Of TSource), keySelector As Func(Of TSource, TKey)) As OrderedParallelQuery(Of TSource)

类型参数

TSource

source 的元素类型。The type of elements of source.

TKey

keySelector 返回的键的类型。The type of the key returned by keySelector.

参数

source
ParallelQuery<TSource>

一个要排序的值序列。A sequence of values to order.

keySelector
Func<TSource,TKey>

用于从元素中提取键的函数。A function to extract a key from an element.

返回

一个 OrderedParallelQuery{TSource},其元素将根据某个键按降序进行排序。An OrderedParallelQuery{TSource} whose elements are sorted descending according to a key.

异常

sourcekeySelector 为 null 引用(在 Visual Basic 中为 Nothing)。source or keySelector is a null reference (Nothing in Visual Basic).

已使用通过 WithCancellation 传递的令牌取消了查询。The query was canceled with the token passed in through WithCancellation.

评估查询期间发生一个或多个异常。One or more exceptions occurred during the evaluation of the query.

注解

与顺序实现不同,这不是一种稳定的排序。In contrast to the sequential implementation, this is not a stable sort. 有关实现稳定排序的方法,请参阅 OrderBy 的备注。See the remarks for OrderBy for an approach to implementing a stable sort.

另请参阅

OrderByDescending<TSource,TKey>(ParallelQuery<TSource>, Func<TSource,TKey>, IComparer<TKey>)

使用指定的比较器按降序对序列的元素排序。Sorts the elements of a sequence in descending order by using a specified comparer.

public:
generic <typename TSource, typename TKey>
[System::Runtime::CompilerServices::Extension]
 static System::Linq::OrderedParallelQuery<TSource> ^ OrderByDescending(System::Linq::ParallelQuery<TSource> ^ source, Func<TSource, TKey> ^ keySelector, System::Collections::Generic::IComparer<TKey> ^ comparer);
public static System.Linq.OrderedParallelQuery<TSource> OrderByDescending<TSource,TKey> (this System.Linq.ParallelQuery<TSource> source, Func<TSource,TKey> keySelector, System.Collections.Generic.IComparer<TKey> comparer);
static member OrderByDescending : System.Linq.ParallelQuery<'Source> * Func<'Source, 'Key> * System.Collections.Generic.IComparer<'Key> -> System.Linq.OrderedParallelQuery<'Source>
<Extension()>
Public Function OrderByDescending(Of TSource, TKey) (source As ParallelQuery(Of TSource), keySelector As Func(Of TSource, TKey), comparer As IComparer(Of TKey)) As OrderedParallelQuery(Of TSource)

类型参数

TSource

source 的元素类型。The type of elements of source.

TKey

keySelector 返回的键的类型。The type of the key returned by keySelector.

参数

source
ParallelQuery<TSource>

一个要排序的值序列。A sequence of values to order.

keySelector
Func<TSource,TKey>

用于从元素中提取键的函数。A function to extract a key from an element.

comparer
IComparer<TKey>

一个用于比较键的 IComparer{TKey}。An IComparer{TKey} to compare keys.

返回

一个 OrderedParallelQuery{TSource},其元素将根据某个键按降序进行排序。An OrderedParallelQuery{TSource} whose elements are sorted descending according to a key.

异常

sourceKeySelector 为 null 引用(在 Visual Basic 中为 Nothing)。source or KeySelector is a null reference (Nothing in Visual Basic).

已使用通过 WithCancellation 传递的令牌取消了查询。The query was canceled with the token passed in through WithCancellation.

评估查询期间发生一个或多个异常。One or more exceptions occurred during the evaluation of the query.

注解

与顺序实现不同,这不是一种稳定的排序。In contrast to the sequential implementation, this is not a stable sort. 有关实现稳定排序的方法,请参阅 OrderBy 的备注。See the remarks for OrderBy for an approach to implementing a stable sort.

另请参阅

适用于