| ObservableExtensionsObservableSelectManyTSource, TTarget Method |
Projects each element of a sequence to an
IListT,
flattens the resulting sequences into one sequence, and invokes a result selector function on each element therein.
If the source is an observable collection, the resulting sequence will track the changes.
Namespace: TomsToolbox.ObservableCollectionsAssembly: TomsToolbox.ObservableCollections (in TomsToolbox.ObservableCollections.dll) Version: 2.21.0+44d18b541fc9419ec3c549350a832394661b2a4d
XMLNS for XAML: Not mapped to an xmlns.
Syntax public static IObservableCollection<TTarget> ObservableSelectMany<TSource, TTarget>(
this IList<TSource> source,
Expression<Func<TSource, IList<TTarget>>> itemGeneratorExpression
)
<ExtensionAttribute>
Public Shared Function ObservableSelectMany(Of TSource, TTarget) (
source As IList(Of TSource),
itemGeneratorExpression As Expression(Of Func(Of TSource, IList(Of TTarget)))
) As IObservableCollection(Of TTarget)
Parameters
- source IListTSource
- A sequence of values to project.
- itemGeneratorExpression ExpressionFuncTSource, IListTTarget
- A property expression of a transform function to apply to each element of the intermediate sequence.
Type Parameters
- TSource
- The type of the elements of source.
- TTarget
- The type of the elements of the resulting sequence.
Return Value
IObservableCollectionTTarget
An
IListT whose elements are the result of invoking the one-to-many transform function defined by
itemGeneratorExpression
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
IListTSource. 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).
Remarks
The selector must always return the same object for the source, else removing elements will fail!
See Also