Click or drag to resize

ObservableExtensionsObservableSelectTSource, TTarget Method

Projects each element of a sequence into a new form.

Namespace: TomsToolbox.ObservableCollections
Assembly: TomsToolbox.ObservableCollections (in TomsToolbox.ObservableCollections.dll) Version: 2.21.0+44d18b541fc9419ec3c549350a832394661b2a4d
XMLNS for XAML: Not mapped to an xmlns.
Syntax
public static IObservableCollection<TTarget> ObservableSelect<TSource, TTarget>(
	this IList<TSource> source,
	Expression<Func<TSource, TTarget>> itemGeneratorExpression
)

Parameters

source  IListTSource
A sequence of values to invoke a transform function on.
itemGeneratorExpression  ExpressionFuncTSource, TTarget
An expression that describes the transform function to apply to each element.

Type Parameters

TSource
The type of the elements of source.
TTarget
The type of the value returned by the transform function compiled from itemGeneratorExpression.

Return Value

IObservableCollectionTTarget
An observable IListT whose elements are the result of invoking the transform function on each element of source.

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
If source is observable, i.e. implements INotifyCollectionChanged, the returned collection is observable, too.

If the itemGeneratorExpression is a property expression like "item => item.SomeProperty" and TSource implements INotifyPropertyChanged, the returned collection will be updated when any items property changes.

See Also