Table of Contents

Method ToEnumerable

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

ToEnumerable<TDocument>(IAsyncCursorSource<TDocument>, CancellationToken)

Wraps a cursor source in an IEnumerable. Each time GetEnumerator is called a new cursor is fetched from the cursor source.

public static IEnumerable<TDocument> ToEnumerable<TDocument>(this IAsyncCursorSource<TDocument> source, CancellationToken cancellationToken = default)

Parameters

source IAsyncCursorSource<TDocument>

The source.

cancellationToken CancellationToken

The cancellation token.

Returns

IEnumerable<TDocument>

An IEnumerable.

Type Parameters

TDocument

The type of the document.