 | ObservableExtensions.ObservableSelect<TSource, TTarget> Method |
Projects each element of a sequence into a new form.
Namespace: TomsToolbox.ObservableCollectionsAssembly: TomsToolbox.ObservableCollections (in TomsToolbox.ObservableCollections.dll) Version: 2.21.0+44d18b541fc9419ec3c549350a832394661b2a4d
XMLNS for XAML: Not mapped to an xmlns.
Syntaxpublic static IObservableCollection<TTarget> ObservableSelect<TSource, TTarget>(
this IList<TSource> source,
Expression<Func<TSource, TTarget>> itemGeneratorExpression
)
<ExtensionAttribute>
Public Shared Function ObservableSelect(Of TSource, TTarget) (
source As IList(Of TSource),
itemGeneratorExpression As Expression(Of Func(Of TSource, TTarget))
) As IObservableCollection(Of TTarget)
Parameters
- source IList<TSource>
- A sequence of values to invoke a transform function on.
- itemGeneratorExpression Expression<Func<TSource, 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
IObservableCollection<TTarget>
An observable
IList<T> 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
IList<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).
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