Table of Contents

Method OrderByDescending

Namespace
MongoDB.Driver.Linq
Assembly
MongoDB.Driver.dll

OrderByDescending<TSource, TKey>(IMongoQueryable<TSource>, Expression<Func<TSource, TKey>>)

Sorts the elements of a sequence in descending order according to a key.

public static IOrderedMongoQueryable<TSource> OrderByDescending<TSource, TKey>(this IMongoQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)

Parameters

source IMongoQueryable<TSource>

A sequence of values to order.

keySelector Expression<Func<TSource, TKey>>

A function to extract a key from an element.

Returns

IOrderedMongoQueryable<TSource>

An IOrderedMongoQueryable<T> whose elements are sorted in descending order according to a key.

Type Parameters

TSource

The type of the elements of source.

TKey

The type of the key returned by the function that is represented by keySelector.