public override void Clear(ref DictionaryStorage storage) { foreach (var item in GetItems()) { Remove(item.Key); } }
public override void Clear(ref DictionaryStorage storage) { _storage.Clear(ref storage); foreach (var item in GetExtraItems()) { TryRemoveExtraValue(item.Key); } }
public override void AddNoLock(ref DictionaryStorage storage, object key, object value) { if (key is string && TrySetExtraValue((string)key, value)) { return; } _storage.AddNoLock(ref storage, key, value); }
/// <summary> /// Adds items from this dictionary into the other dictionary /// </summary> public virtual void CopyTo(ref DictionaryStorage/*!*/ into) { Debug.Assert(into != null); foreach (KeyValuePair<object, object> kvp in GetItems()) { into.Add(ref into, kvp.Key, kvp.Value); } }
public override void Add(ref DictionaryStorage storage, object key, object value) { string strKey = key as string; if (strKey != null) { TotemOps.ScopeSetMember(_context.SharedContext, _scope, strKey, value); } else { TotemScopeExtension ext = (TotemScopeExtension)_context.EnsureScopeExtension(_scope); ext.EnsureObjectKeys().Add(key, value); } }
public override void Add(ref DictionaryStorage storage, object key, object value) { lock (this) { if (storage == this) { CommonDictionaryStorage newStorage = new CommonDictionaryStorage(); newStorage.AddNoLock(key, value); storage = newStorage; return; } } // race, try again... storage.Add(ref storage, key, value); }
public abstract bool Remove(ref DictionaryStorage storage, object key);
public abstract void Clear(ref DictionaryStorage storage);
public override void AddNoLock(ref DictionaryStorage storage, object key, object value) { AddNoLock(key, value); }
public abstract void Add(ref DictionaryStorage storage, object key, object value);
public virtual void AddNoLock(ref DictionaryStorage storage, object key, object value) { Add(ref storage, key, value); }
public override bool Remove(ref DictionaryStorage storage, object key) { return false; }
public virtual bool TryRemoveValue(ref DictionaryStorage storage, object key, out object value) { if (TryGetValue(key, out value)) { return Remove(ref storage, key); } return false; }
public override void Clear(ref DictionaryStorage storage) { }
public override bool TryRemoveValue(ref DictionaryStorage storage, object key, out object value) { return TryRemoveValue(key, out value); }
private void UncommonCopyTo(ref DictionaryStorage into) { for (int i = 0; i < _buckets.Length; i++) { Bucket curBucket = _buckets[i]; if (curBucket.Key != null && curBucket.Key != _removed) { into.AddNoLock(ref into, curBucket.Key, curBucket.Value); } } }
public DictionaryStorage CopyTo(DictionaryStorage into) { Debug.Assert(into != null); if (_buckets != null) { using (new OrderedLocker(this, into)) { CommonDictionaryStorage commonInto = into as CommonDictionaryStorage; if (commonInto != null) { CommonCopyTo(commonInto); } else { UncommonCopyTo(ref into); } } } var nullValue = _nullValue; if (nullValue != null) { into.Add(ref into, null, nullValue.Value); } return into; }
public override void CopyTo(ref DictionaryStorage/*!*/ into) { into = CopyTo(into); }