[]
Creates an IndexedCollection<T> based on the specified INotifyCollectionChanged data source.
public static IndexedCollection<T> ToIndexed<T>(this INotifyCollectionChanged source)
Type | Name | Description |
---|---|---|
INotifyCollectionChanged | source | An INotifyCollectionChanged data source to represent as an IndexedCollection<T>. |
Type | Description |
---|---|
IndexedCollection<T> | An IndexedCollection<T> that contains the same elements as the INotifyCollectionChanged and enables indexing of that data source. |
Name | Description |
---|---|
T | The type of the elements in the collection. |
Use this method to index and query your existing data sources implementing INotifyCollectionChanged. The element type of this data source must implement INotifyPropertyChanged, see Using the built-in collection class IndexedCollection(T) (LiveLinq to Objects)|tag=Using_the_built_in_collection_class_IndexedCollectionT_LiveLinq_to_Objects.
The collection returned by this method also implements the INotifyCollectionChanged interface, because this method actually returns objects of an internal derived class that implements that interface.
Note: Indexes created on the resulting IndexedCollection<T> are owned by it and not by the original data source. Every ToIndexed() call creates a separate object that has its own separate indexes. Avoid calling ToIndexed() repeatedly for the same collection because it can increase the cost of maintaining indexes.
A typed specialization of the ToIndexed<T>(INotifyCollectionChanged) method.
public static IndexedCollection<T> ToIndexed<T>(this ObservableCollection<T> source)
Type | Name | Description |
---|---|---|
ObservableCollection<T> | source | An ObservableCollection<T> represent as an IndexedCollection<T>. |
Type | Description |
---|---|
IndexedCollection<T> | An IndexedCollection<T> that contains the same elements as the ObservableCollection<T> and enables indexing of that collection. |
Name | Description |
---|---|
T | The type of the elements in the collection. |