Click or drag to resize

MongoQueryableSelectManyTSource, TCollection, TResult Method (IMongoQueryableTSource, ExpressionFuncTSource, IEnumerableTCollection, ExpressionFuncTSource, TCollection, TResult)

Projects each element of a sequence to an IEnumerableT and invokes a result selector function on each element therein. The resulting values from each intermediate sequence are combined into a single, one-dimensional sequence and returned.

Namespace:  MongoDB.Driver.Linq
Assembly:  MongoDB.Driver (in MongoDB.Driver.dll) Version: 2.5.0+57.Branch.master.Sha.6a4e00a2d91090c65a9b11364b9ebfdb9c7da076
Syntax
public static IMongoQueryable<TResult> SelectMany<TSource, TCollection, TResult>(
	this IMongoQueryable<TSource> source,
	Expression<Func<TSource, IEnumerable<TCollection>>> collectionSelector,
	Expression<Func<TSource, TCollection, TResult>> resultSelector
)

Parameters

source
Type: MongoDB.Driver.LinqIMongoQueryableTSource
A sequence of values to project.
collectionSelector
Type: System.Linq.ExpressionsExpressionFuncTSource, IEnumerableTCollection
A projection function to apply to each element of the input sequence.
resultSelector
Type: System.Linq.ExpressionsExpressionFuncTSource, TCollection, TResult
A projection function to apply to each element of each intermediate sequence.

Type Parameters

TSource
The type of the elements of source.
TCollection
The type of the intermediate elements collected by the function represented by collectionSelector.
TResult
The type of the elements of the resulting sequence.

Return Value

Type: IMongoQueryableTResult
An IMongoQueryableT whose elements are the result of invoking the one-to-many projection function collectionSelector on each element of source and then mapping each of those sequence elements and their corresponding source element to a result element.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IMongoQueryableTSource. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also