ProjectionHelperProjectTOriginalCollection, TOriginal, TProjected Method |
Namespace: Lawo.ComponentModel
public static DisposableReadOnlyObservableCollection<TProjected> Project<TOriginalCollection, TOriginal, TProjected>( this TOriginalCollection originalItems, Func<TOriginal, TProjected> projectionFunction ) where TOriginalCollection : Object, IEnumerable<TOriginal>, IList, INotifyCollectionChanged
Exception | Condition |
---|---|
ArgumentNullException | originalItems and/or projectionFunction equal null. |
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.