I've got a collection of objects with the following interface:
public IEntity
{
public string Key1 { get; set; }
public string Key2 { get; set; }
... some other properties
}
and am looking for the best strategy for querying an in memory collection of these objects via linq. The majority of queries (but not all) are likely to look for Key1 or Key2 to access the entity, so I'm not sure what is the most performant way to query them. My thought are:
IList< IEntity>
Just stick them in a list an use linq to filter them
IDictionary< Tuple< string, string>, IEntity>
Create a mult-key dictionary using key1 and key2, though I'm not sure how I could access the IEntity if I only know one part?
Something else
Is there some other, better way to achieve this?