DataSource for Entity Framework in WPF
LiveLinq / How to use LiveLinq / How to Query Collections with LiveLinq / LiveLinq to Objects: IndexedCollection (T) and other Collection Classes
In This Topic
    LiveLinq to Objects: IndexedCollection (T) and other Collection Classes
    In This Topic

    Querying general collection classes in LiveLinq is called LiveLinq to Objects, to distinguish it from LiveLinq to DataSet and LiveLinq to XML that query such specific data sources as DataSet and XML. So use LiveLinq to DataSet if you need to query data in a DataSet and LiveLinq to XML if your data is in XML. For other cases, we already saw two options in LiveLinq to Objects:

    a.        Use IndexedCollection<T> if you don't have preexisting collection classes and rely on LiveLinq to supply them.

    b.       Apply ToIndexed() to preexisting collection classes that support data binding.

    And there is also a more advanced option that is not frequently needed:

    c.        Define your own collection class, usually derived from  IndexedCollection<T>, if you want some non-standard functionality.

    And finally, an option that can also be considered advanced, but, actually, is not particularly difficult, and allows you to bring virtually any collection into the LiveLinq orbit:

    d.       You can make any existing collection class C usable in LiveLinq provided that it somehow lets you know when changes occur. Then you can create an adapter class implementing the C1.LiveLinq.IObservableSource<T> interface and delegating most of its functionality to that preexisting collection class. Having an IObservableSource<T> implementation, you can apply the ToIndexed()|keyword=ToIndexed(T) Method (IObservableSource(T)) extension method to it, it will return IIndexedSource<T>. LiveLinq extension methods implementing query operators take IIndexedSource<T> as their argument, see IndexedQueryExtensions.