Table of Contents

Method ToList

Namespace
MongoDB.Driver
Assembly
MongoDB.Driver.Core.dll

ToList<TDocument>(IAsyncCursor<TDocument>, CancellationToken)

Returns a list containing all the documents returned by a cursor.

public static List<TDocument> ToList<TDocument>(this IAsyncCursor<TDocument> source, CancellationToken cancellationToken = default)

Parameters

source IAsyncCursor<TDocument>

The source.

cancellationToken CancellationToken

The cancellation token.

Returns

List<TDocument>

The list of documents.

Type Parameters

TDocument

The type of the document.