示例#1
0
        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);
        }
示例#2
0
        /// <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) {
     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);
 }
示例#4
0
        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);
        }
示例#5
0
        /// <summary>
        /// Adds items from this dictionary into the other dictionary
        /// </summary>
        public virtual void CopyTo(DictionaryStorage/*!*/ into) {
            Debug.Assert(into != null);

            foreach (KeyValuePair<object, object> kvp in GetItems()) {
                into.Add(kvp.Key, kvp.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;
        }