Multi-key dictionaries (of another kind) in C#?
Posted
by Matthew Scharley
on Stack Overflow
See other posts from Stack Overflow
or by Matthew Scharley
Published on 2009-07-23T13:54:19Z
Indexed on
2010/04/22
16:33 UTC
Read the original article
Hit count: 122
c#
|data-structures
Building on this question, is there a simple solution for having a multi-key dictionary where either key individually can be used to identify the value?
ie.
MultikeyDictionary<TKey1, TKey2, TValue> foo;
foo.Add(key1, key2, value);
myValue = foo[key1];
// value == myValue
foo.Remove(key2);
myValue = foo[key1]; // invalid, Exception or null returned
© Stack Overflow or respective owner