Enumerable.OrderDescending Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
OrderDescending<T>(IEnumerable<T>, IComparer<T>) |
Sorts the elements of a sequence in descending order. |
OrderDescending<T>(IEnumerable<T>) |
Sorts the elements of a sequence in descending order. |
OrderDescending<T>(IEnumerable<T>, IComparer<T>)
- Source:
- OrderBy.cs
- Source:
- OrderBy.cs
- Source:
- OrderBy.cs
Sorts the elements of a sequence in descending order.
public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
static System::Linq::IOrderedEnumerable<T> ^ OrderDescending(System::Collections::Generic::IEnumerable<T> ^ source, System::Collections::Generic::IComparer<T> ^ comparer);
public static System.Linq.IOrderedEnumerable<T> OrderDescending<T> (this System.Collections.Generic.IEnumerable<T> source, System.Collections.Generic.IComparer<T>? comparer);
static member OrderDescending : seq<'T> * System.Collections.Generic.IComparer<'T> -> System.Linq.IOrderedEnumerable<'T>
<Extension()>
Public Function OrderDescending(Of T) (source As IEnumerable(Of T), comparer As IComparer(Of T)) As IOrderedEnumerable(Of T)
Type Parameters
- T
The type of the elements of source
.
Parameters
- source
- IEnumerable<T>
A sequence of values to order.
- comparer
- IComparer<T>
An IComparer<T> to compare keys.
Returns
An IOrderedEnumerable<TElement> whose elements are sorted.
Exceptions
source
is null
.
Remarks
This method is implemented by using deferred execution. The immediate return value is an object that stores all the information that is required to perform the action. The query represented by this method is not executed until the object is enumerated by calling its <see cref="M:System.Collections.Generic.IEnumerable`1.GetEnumerator> method.
If comparer is null
, the default comparer <see cref="P:System.Collections.Generic.Comparer`1.Default> is used to compare elements.
Applies to
OrderDescending<T>(IEnumerable<T>)
- Source:
- OrderBy.cs
- Source:
- OrderBy.cs
- Source:
- OrderBy.cs
Sorts the elements of a sequence in descending order.
public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
static System::Linq::IOrderedEnumerable<T> ^ OrderDescending(System::Collections::Generic::IEnumerable<T> ^ source);
public static System.Linq.IOrderedEnumerable<T> OrderDescending<T> (this System.Collections.Generic.IEnumerable<T> source);
static member OrderDescending : seq<'T> -> System.Linq.IOrderedEnumerable<'T>
<Extension()>
Public Function OrderDescending(Of T) (source As IEnumerable(Of T)) As IOrderedEnumerable(Of T)
Type Parameters
- T
The type of the elements of source
.
Parameters
- source
- IEnumerable<T>
A sequence of values to order.
Returns
An IOrderedEnumerable<TElement> whose elements are sorted.
Exceptions
source
is null
.
Remarks
This method is implemented by using deferred execution. The immediate return value is an object that stores all the information that is required to perform the action. The query represented by this method is not executed until the object is enumerated by calling its <see cref="M:System.Collections.Generic.IEnumerable`1.GetEnumerator> method.
This method compares elements by using the default comparer <see cref="P:System.Collections.Generic.Comparer`1.Default>.
Applies to
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應