Click or drag to resize
ProjectionHelperProjectTOriginalCollection, TOriginal, TProjected Method
Returns a collection of items projected from the items in originalItems.

Namespace: Lawo.ComponentModel
Assembly: Lawo (in Lawo.dll) Version: 1.4.1707.27006
Syntax
C#
public static DisposableReadOnlyObservableCollection<TProjected> Project<TOriginalCollection, TOriginal, TProjected>(
	this TOriginalCollection originalItems,
	Func<TOriginal, TProjected> projectionFunction
)
where TOriginalCollection : Object, IEnumerable<TOriginal>, IList, INotifyCollectionChanged

Parameters

originalItems
Type: TOriginalCollection
The collection of original items to project.
projectionFunction
Type: SystemFuncTOriginal, TProjected
Represents the method that converts an object of TOriginal type to TProjected type. For a given TOriginal object, this method is guaranteed to be called only ever once.

Type Parameters

TOriginalCollection
The type of originalItems.
TOriginal
The type of the items in originalItems.
TProjected
The type of the items in the returned collection.

Return Value

Type: DisposableReadOnlyObservableCollectionTProjected

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type . 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).
Exceptions
ExceptionCondition
ArgumentNullExceptionoriginalItems and/or projectionFunction equal null.
Remarks

All operations on originalItems are automatically matched by an equivalent operation on the returned collection such that for each item in the original collection there is always exactly one item in this collection. Moreover, each projected item is always located at the same index as its original item.

Note: Due to the nature of the INotifyCollectionChanged interface and the guarantee that the projection function is called exactly once for a given original item, the returned collection must internally store a dictionary that maps each original item to its corresponding projected item. The implementation currently only ever adds to this dictionary, so it will always contain all original and their associated projected items that have ever been added to the original collection.

See Also