Indexed properties with Linq?
In a database we create indexes on columns that we want to query with joins.
Does Linq to objects facilitate this in any way?I imagine that search performance could be (much) improved when somehow List's can be supported by binary trees (indexes) in memory that are mapped to spec开发者_运维问答ific properties of T.
I am thinking of Lists that do not have to be optimized for inserts or deletes.
One could turn off the index for another optimization.No; LINQ does not use indexes.
Instead, you can use i4o, which does.
Note that many LINQ operations, such as Distinct
, Join
, GroupBy
, and others, will build a hasttable (or hashset, as appropriate) to avoid O(n2) performance.
For more information, see Jon Skeet's EduLINQ series.
精彩评论