/// <summary> /// Accesses the value for the specified key. /// </summary> public V this[K key] { get { return(ReadOperation[key]); } set { if (!IsDummy) { if (ReadOperation.HasNoClones) { WriteOperation[key] = value; } else { // Try to avoid a clone if it already is present with the same value V existingValue = default(V); if (!ReadOperation.TryGetValue(key, out existingValue) || !EqualityComparer <V> .Default.Equals(existingValue, value)) { WriteOperation[key] = value; } } } } }
/// <summary> /// Attempts to find the value for the specified key in the dictionary. /// </summary> public bool TryGetValue(K key, out V value) { return(ReadOperation.TryGetValue(key, out value)); }