public bool ContainsKey(K2 key2) { lock (Locker) { return(Key2ToKey1.ContainsKey(key2)); } }
public void Add(K1 key1, K2 key2) { lock (Locker) { Key1ToKey2.Add(key1, key2); Key2ToKey1.Add(key2, key1); } }
public K1 Get(K2 key2) { lock (Locker) { K1 key1; if (Key2ToKey1.TryGetValue(key2, out key1)) { return(key1); } else { return(default(K1)); } } }
public bool Remove(K2 key2) { lock (Locker) { K1 key1; if (Key2ToKey1.TryGetValue(key2, out key1)) { Key2ToKey1.Remove(key2); Key1ToKey2.Remove(key1); return(true); } else { return(false); } } }