csharpula csharp wrote:
And how will I bound the two dictionaries for this purpose?
How to implement this?
Thanks.
You just put two dictionaries in a class, and when you add an item, add
it to both dictionaries.
Starting point:
class DoubleDictionary<Key, Value{
private Dictionary<Key, Value_values = new Dictionary<Key, Value>();
private Dictionary<Value, Key_keys = new Dictionary<Value, Key>();
public void Add(Key key, Value value) {
_values.Add(key, value);
_keys.Add(value, key);
}
public Value GetByKey(Key key) {
return _values[key];
}
public Key GetByValue(Value value) {
return _keys[value];
}
}
--
Göran Andersson
_____
http://www.guffa.com