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.10.0+569905ff5e778c38ea19d9d0392496a83e1704ed
public static IMongoQueryable<TResult> SelectMany<TSource, TCollection, TResult>(
	this IMongoQueryable<TSource> source,
	Expression<Func<TSource, IEnumerable<TCollection>>> collectionSelector,
	Expression<Func<TSource, TCollection, TResult>> resultSelector


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

Type Parameters

The type of the elements of source.
The type of the intermediate elements collected by the function represented by collectionSelector.
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