Dictionary with a combination of values as key.... -
11-18-2007
, 03:49 PM
I need to represent some data in memory which needs the performance of a
Dictionary lookup, but the key for these data consists of multible values,
e.g.:
Data has a structure like this:
ProductId (key) InventId (key) Property1 (value) Property2 (value)
1234 1 <somevalue>
<somevalue>
1234 2 <somevalue>
<somevalue>
1237 1 <somevalue>
<somevalue>
The unique key in this case is a combination of <ProductId> and <InventId>
My first idea was to startout having the key a new Generic class e.g.
Key<T1,T2> for use with Dictionary<Key<T1,T2>, ProductRelation> etc..
- But this solution is not usable for more than two values for the key ....
What is the "best" way to do it if you want max flexibility and max
performance ??
Regards, Rune |