Language

Queryable.OrderDescending Method

Definition

Overloads

Name Description
OrderDescending(IQueryable)

Sorts the elements of a sequence in descending order.

OrderDescending(IQueryable, IComparer)

Sorts the elements of a sequence in descending order.

OrderDescending(IQueryable)

Source:
Queryable.cs
Source:
Queryable.cs
Source:
Queryable.cs
Source:
Queryable.cs
Source:
Queryable.cs

Sorts the elements of a sequence in descending order.

public:
generic 
[System::Runtime::CompilerServices::Extension]
 static System::Linq::IOrderedQueryable ^ OrderDescending(System::Linq::IQueryable ^ source);
public static System.Linq.IOrderedQueryable OrderDescending(this System.Linq.IQueryable source);
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Enumerating collections as IQueryable can require creating new generic types or methods, which requires creating code at runtime. This may not work when AOT compiling.")]
public static System.Linq.IOrderedQueryable OrderDescending(this System.Linq.IQueryable source);
static member OrderDescending : System.Linq.IQueryable<'T> -> System.Linq.IOrderedQueryable<'T>
[]
static member OrderDescending : System.Linq.IQueryable<'T> -> System.Linq.IOrderedQueryable<'T>

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

A sequence of values to order.

Returns

An IOrderedEnumerable whose elements are sorted.

Attributes

Exceptions

source is null.

Remarks

This method has at least one parameter of type Expression whose type argument is one of the Func types. For these parameters, you can pass in a lambda expression and it will be compiled to an Expression.

The Order(IQueryable) method generates a MethodCallExpression that represents calling Order(IEnumerable) itself as a constructed generic method. It then passes the MethodCallExpression to the CreateQuery(Expression) method of the IQueryProvider represented by the Provider property of the source parameter. The result of calling CreateQuery(Expression) is cast to type IOrderedQueryable and returned.

The query behavior that occurs as a result of executing an expression tree that represents calling Order(IEnumerable) depends on the implementation of the source parameter. The expected behavior is that it sorts the elements of source by itself.

Applies to

OrderDescending(IQueryable, IComparer)

Source:
Queryable.cs
Source:
Queryable.cs
Source:
Queryable.cs
Source:
Queryable.cs
Source:
Queryable.cs

Sorts the elements of a sequence in descending order.

public:
generic 
[System::Runtime::CompilerServices::Extension]
 static System::Linq::IOrderedQueryable ^ OrderDescending(System::Linq::IQueryable ^ source, System::Collections::Generic::IComparer ^ comparer);
public static System.Linq.IOrderedQueryable OrderDescending(this System.Linq.IQueryable source, System.Collections.Generic.IComparer comparer);
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("Enumerating collections as IQueryable can require creating new generic types or methods, which requires creating code at runtime. This may not work when AOT compiling.")]
public static System.Linq.IOrderedQueryable OrderDescending(this System.Linq.IQueryable source, System.Collections.Generic.IComparer comparer);
static member OrderDescending : System.Linq.IQueryable<'T> * System.Collections.Generic.IComparer<'T> -> System.Linq.IOrderedQueryable<'T>
[]
static member OrderDescending : System.Linq.IQueryable<'T> * System.Collections.Generic.IComparer<'T> -> System.Linq.IOrderedQueryable<'T>

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

A sequence of values to order.

comparer
IComparer

An IComparer to compare elements.

Returns

An IOrderedEnumerable whose elements are sorted.

Attributes

Exceptions

source is null.

Remarks

This method has at least one parameter of type Expression whose type argument is one of the Func types. For these parameters, you can pass in a lambda expression and it will be compiled to an Expression.

The Order(IQueryable) method generates a MethodCallExpression that represents calling Order(IEnumerable) itself as a constructed generic method. It then passes the MethodCallExpression to the CreateQuery(Expression) method of the IQueryProvider represented by the Provider property of the source parameter. The result of calling CreateQuery(Expression) is cast to type IOrderedQueryable and returned.

The query behavior that occurs as a result of executing an expression tree that represents calling Order(IEnumerable) depends on the implementation of the source parameter. The expected behavior is that it sorts the elements of source by itself.

Applies to