Table of Contents

Method As

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

As<TSource, TResult>(IQueryable<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 IQueryable<TResult> As<TSource, TResult>(this IQueryable<TSource> source, IBsonSerializer<TResult> resultSerializer = null)

Parameters

source IQueryable<TSource>

A sequence of values.

resultSerializer IBsonSerializer<TResult>

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

Returns

IQueryable<TResult>

A new IQueryable with a new result type.

Type Parameters

TSource

The type of the elements of source.

TResult

The new result type for the results.