Queryable.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>(IQueryable<T>) |
Sorts the elements of a sequence in descending order. |
OrderDescending<T>(IQueryable<T>, IComparer<T>) |
Sorts the elements of a sequence in descending order. |
OrderDescending<T>(IQueryable<T>)
- Source:
- Queryable.cs
- Source:
- Queryable.cs
- Source:
- Queryable.cs
Sorts the elements of a sequence in descending order.
public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
static System::Linq::IOrderedQueryable<T> ^ OrderDescending(System::Linq::IQueryable<T> ^ source);
public static System.Linq.IOrderedQueryable<T> OrderDescending<T> (this System.Linq.IQueryable<T> source);
static member OrderDescending : System.Linq.IQueryable<'T> -> System.Linq.IOrderedQueryable<'T>
<Extension()>
Public Function OrderDescending(Of T) (source As IQueryable(Of T)) As IOrderedQueryable(Of T)
Type Parameters
- T
The type of the elements of source
.
Parameters
- source
- IQueryable<T>
A sequence of values to order.
Returns
An IOrderedEnumerable<TElement> whose elements are sorted.
Exceptions
source
is null
.
Remarks
This method has at least one parameter of type Expression<TDelegate> whose type argument is one of the Func<T,TResult> types. For these parameters, you can pass in a lambda expression and it will be compiled to an Expression<TDelegate>.
The Order<T>(IQueryable<T>) method generates a MethodCallExpression that represents
calling Order<T>(IEnumerable<T>) itself as a constructed generic method.
It then passes the MethodCallExpression to the CreateQuery<TElement>(Expression) method
of the IQueryProvider represented by the Provider property of the source
parameter. The result of calling CreateQuery<TElement>(Expression) is cast to
type IOrderedQueryable<T> and returned.
The query behavior that occurs as a result of executing an expression tree
that represents calling Order<T>(IEnumerable<T>)
depends on the implementation of the source
parameter.
The expected behavior is that it sorts the elements of source
by itself.
Applies to
OrderDescending<T>(IQueryable<T>, IComparer<T>)
- Source:
- Queryable.cs
- Source:
- Queryable.cs
- Source:
- Queryable.cs
Sorts the elements of a sequence in descending order.
public:
generic <typename T>
[System::Runtime::CompilerServices::Extension]
static System::Linq::IOrderedQueryable<T> ^ OrderDescending(System::Linq::IQueryable<T> ^ source, System::Collections::Generic::IComparer<T> ^ comparer);
public static System.Linq.IOrderedQueryable<T> OrderDescending<T> (this System.Linq.IQueryable<T> source, System.Collections.Generic.IComparer<T> comparer);
static member OrderDescending : System.Linq.IQueryable<'T> * System.Collections.Generic.IComparer<'T> -> System.Linq.IOrderedQueryable<'T>
<Extension()>
Public Function OrderDescending(Of T) (source As IQueryable(Of T), comparer As IComparer(Of T)) As IOrderedQueryable(Of T)
Type Parameters
- T
The type of the elements of source
.
Parameters
- source
- IQueryable<T>
A sequence of values to order.
- comparer
- IComparer<T>
An IComparer<T> to compare elements.
Returns
An IOrderedEnumerable<TElement> whose elements are sorted.
Exceptions
source
is null
.
Remarks
This method has at least one parameter of type Expression<TDelegate> whose type argument is one of the Func<T,TResult> types. For these parameters, you can pass in a lambda expression and it will be compiled to an Expression<TDelegate>.
The Order<T>(IQueryable<T>) method generates a MethodCallExpression that represents
calling Order<T>(IEnumerable<T>) itself as a constructed generic method.
It then passes the MethodCallExpression to the CreateQuery<TElement>(Expression) method
of the IQueryProvider represented by the Provider property of the source
parameter. The result of calling CreateQuery<TElement>(Expression) is cast to
type IOrderedQueryable<T> and returned.
The query behavior that occurs as a result of executing an expression tree
that represents calling Order<T>(IEnumerable<T>)
depends on the implementation of the source
parameter.
The expected behavior is that it sorts the elements of source
by itself.