Table of Contents

Method As

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

As<TSource, TResult>(IMongoQueryable<TSource>, IBsonSerializer<TResult>)

Allows the results to be interpreted as a different type. It is up to the caller to determine that the new result type is compatible with the actual results.

public static IMongoQueryable<TResult> As<TSource, TResult>(this IMongoQueryable<TSource> source, IBsonSerializer<TResult> resultSerializer = null)

Parameters

source IMongoQueryable<TSource>

A sequence of values.

resultSerializer IBsonSerializer<TResult>

The new serializer (optional, will be looked up if null).

Returns

IMongoQueryable<TResult>

A new IMongoQueryable with a new result type.

Type Parameters

TSource

The type of the elements of source.

TResult

The new result type for the results.