Click or drag to resize

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.ObservableCollections
Assembly:  TomsToolbox.ObservableCollections (in TomsToolbox.ObservableCollections.dll)
Syntax
public static IObservableCollection<TTarget> ObservableSelectMany<TSource, TTarget>(
	this IList<TSource> source,
	Expression<Func<TSource, IList<TTarget>>> itemGeneratorExpression
)

Parameters

source
Type: System.Collections.GenericIListTSource
A sequence of values to project.
itemGeneratorExpression
Type: System.Linq.ExpressionsExpressionFuncTSource, 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

Type: 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