Table of Contents

Method Top

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

Top<TSource, TResult>(IEnumerable<TSource>, SortDefinition<TSource>, Func<TSource, TResult>)

Returns the top n results.

public static TResult Top<TSource, TResult>(this IEnumerable<TSource> source, SortDefinition<TSource> sortBy, Func<TSource, TResult> selector)

Parameters

source IEnumerable<TSource>

The source.

sortBy SortDefinition<TSource>

The sort order.

selector Func<TSource, TResult>

The selector.

Returns

TResult

The top n results.

Type Parameters

TSource

The source type.

TResult

The result type.