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.7.3+Branch.v2.7.x.Sha.2f1f2be13a23b8520cb9c2ee8439c022f9a03efe
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