Get KeyValuePair by Key from a ConcurrentDictionary (in O(1) time)
问题 As per this solution (https://stackoverflow.com/a/18923091/529618) I am using a ConcurrentDictionary<T,byte> as a workaround for the lack of ConcurrentHashSet<T> . However, I'm struggling to see how I can get the original T Key back out of the dictionary in O(1) time. var cache = new ConcurrentDictionary<MyEquatableClass, byte>()); //... if(!cache.TryAdd(classInstance, Byte.MinValue)) return /* Existing cache entry */; return classInstance; Is there any way to get the KeyValuePair<K,V> (or