DataSource for Entity Framework in WPF
C1.LiveLinq.Indexing Namespace / Index<T,TKey> Class
The type of the elements of the collection to index.
The type of the index key.

In This Topic
    Index<T,TKey> Class
    In This Topic
    Indexes a collection by an expression (typically, by a field), providing fast access to items having particular values (or range of values) of that expression.
    Object Model
    Index<T,TKey> Class
    Type Parameters
    The type of the elements of the collection to index.
    The type of the index key.

    Indexes can be created and added to a collection explicitly in code by calling IndexCollection.Add, or their creation can be enforced in LINQ queries by using the Indexed hint.

    In LINQ queries, indexes are used for optimizing query performance if that is specified with an Indexed hint. Usually, hints are not required, because LiveLinq can automatically determine that an index can be used to speedup a query, but using hints helps to ensure this optimization.

    Indexes can also be used programmatically in code, without LINQ syntax, by using the methods of the C1.LiveLinq.Indexing.Search.IIndexScanner<T,TKey> interface that is implemented by the Index<T,TKey> class. For example, you can call such methods as Find directly for an Index<T,TKey> object.

    It must be kept in mind that every index you create introduces a trade-off: it can dramatically speed up searches, but it consumes memory and adds some (usually, small) overhead every time the indexed collection (or any of the items, its elements) is modified. This is why indexes should generally be kept only while you need them for queries. To delete an index, use IndexCollection.Remove.

    An index can have subindexes, see Subindex<T,TKey>. Subindexes are optional, not required for any indexing tasks, but can provide additional optimization and help minimize memory requirements when a collection is indexed by multiple keys. In presence of subindexes, an index is the root level of a tree of subindexes.

    Inheritance Hierarchy


    See Also