[]
        
(Showing Draft Content)

C1.WPF.LiveLinq.WpfExtensions.ToIndexed

ToIndexed Method

ToIndexed<T>(INotifyCollectionChanged)

Creates an IndexedCollection<T> based on the specified INotifyCollectionChanged data source.

Declaration
public static IndexedCollection<T> ToIndexed<T>(this INotifyCollectionChanged source)
Parameters
Type Name Description
INotifyCollectionChanged source

An INotifyCollectionChanged data source to represent as an IndexedCollection<T>.

Returns
Type Description
IndexedCollection<T>

An IndexedCollection<T> that contains the same elements as the INotifyCollectionChanged and enables indexing of that data source.

Type Parameters
Name Description
T

The type of the elements in the collection.

Remarks

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.

ToIndexed<T>(ObservableCollection<T>)

A typed specialization of the ToIndexed<T>(INotifyCollectionChanged) method.

Declaration
public static IndexedCollection<T> ToIndexed<T>(this ObservableCollection<T> source)
Parameters
Type Name Description
ObservableCollection<T> source

An ObservableCollection<T> represent as an IndexedCollection<T>.

Returns
Type Description
IndexedCollection<T>

An IndexedCollection<T> that contains the same elements as the ObservableCollection<T> and enables indexing of that collection.

Type Parameters
Name Description
T

The type of the elements in the collection.