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)
Syntax
public static IObservableCollection<TTarget> ObservableSelect<TSource, TTarget>(
	this IList<TSource> source,
	Expression<Func<TSource, TTarget>> itemGeneratorExpression
)

Parameters

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

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