How to implement a multi-index dictionary?
c#, collections, dictionary, generics, thread-safety
Solution
I would implement a data structure with these two dictionaries
Dictionary<TKey1, KeyValuePair<TKey2, TValue>> dict1;
Dictionary<TKey2, KeyValuePair<TKey1, TValue>> dict2;
That way if you are given 1 key you have both the value and the other key as well for easy deletes and updates.
Problem
Basically I want something like Dictionary<Tkey1, TKey2, TValue>, but not (as I've seen here in other question) with the keys in AND, but in OR. To better explain: I want to be able to find an element in the dictionary providing just one of the keys, not both. I also think we should consider thread-safety and the ability to easily scale to a Dictionary<Tkey1, TKey2, TKeyN, TValue> solution...