MongoQueryable.SelectMany<TSource, TCollection, TResult> Method (IMongoQueryable<TSource>, Expression<Func<TSource, IEnumerable<TCollection>>>, Expression<Func<TSource, TCollection, TResult>>) |
Projects each element of a sequence to an
IEnumerable<T> 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.19.1+3a2a09dd959482f665ffbb5df2557ec541597af4
Syntaxpublic static IMongoQueryable<TResult> SelectMany<TSource, TCollection, TResult>(
this IMongoQueryable<TSource> source,
Expression<Func<TSource, IEnumerable<TCollection>>> collectionSelector,
Expression<Func<TSource, TCollection, TResult>> resultSelector
)
<ExtensionAttribute>
Public Shared Function SelectMany(Of TSource, TCollection, TResult) (
source As IMongoQueryable(Of TSource),
collectionSelector As Expression(Of Func(Of TSource, IEnumerable(Of TCollection))),
resultSelector As Expression(Of Func(Of TSource, TCollection, TResult))
) As IMongoQueryable(Of TResult)
[<ExtensionAttribute>]
static member SelectMany :
source : IMongoQueryable<'TSource> *
collectionSelector : Expression<Func<'TSource, IEnumerable<'TCollection>>> *
resultSelector : Expression<Func<'TSource, 'TCollection, 'TResult>> -> IMongoQueryable<'TResult>
Parameters
- source
- Type: MongoDB.Driver.Linq.IMongoQueryable<TSource>
A sequence of values to project. - collectionSelector
- Type: System.Linq.Expressions.Expression<Func<TSource, IEnumerable<TCollection>>>
A projection function to apply to each element of the input sequence. - resultSelector
- Type: System.Linq.Expressions.Expression<Func<TSource, 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:
IMongoQueryable<TResult>
An
IMongoQueryable<T> 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
IMongoQueryable<TSource>. 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