Add() private méthode

Add helper that works over a single set of buckets. Used for both the normal add case as well as the resize case.
private Add ( Bucket buckets, object key, object value ) : bool
buckets Bucket
key object
value object
Résultat bool
Exemple #1
0
 private void AddEnvironmentVars()
 {
     try {
         foreach (DictionaryEntry de in Environment.GetEnvironmentVariables())
         {
             _storage.Add(de.Key, de.Value);
         }
     } catch (SecurityException) {
         // environment isn't available under partial trust
     }
 }
 public virtual DictionaryStorage Clone() {
     CommonDictionaryStorage storage = new CommonDictionaryStorage();
     foreach (KeyValuePair<object, object> kvp in GetItems()) {
         storage.Add(kvp.Key, kvp.Value);
     }
     return storage;
 }
Exemple #3
0
 void ISet.SetData(IEnumerable set)
 {
     _items = new CommonDictionaryStorage();
     foreach (object o in set)
     {
         _items.Add(o, o);
     }
 }
Exemple #4
0
 public void Add(object key, object value)
 {
     if (key is string && TrySetExtraValue((string)key, value))
     {
         return;
     }
     _storage.Add(key, value);
 }
Exemple #5
0
 public override void Add(ref DictionaryStorage storage, object key, object value)
 {
     if (key is string && TrySetExtraValue((string)key, value))
     {
         return;
     }
     _storage.Add(key, value);
 }
Exemple #6
0
        public virtual DictionaryStorage Clone()
        {
            CommonDictionaryStorage storage = new CommonDictionaryStorage();

            foreach (KeyValuePair <object, object> kvp in GetItems())
            {
                storage.Add(kvp.Key, kvp.Value);
            }
            return(storage);
        }
Exemple #7
0
        private static CommonDictionaryStorage ListToDictionary(object set)
        {
            IEnumerator             setData = PythonOps.GetEnumerator(set);
            CommonDictionaryStorage items   = new CommonDictionaryStorage();

            while (setData.MoveNext())
            {
                object o = setData.Current;
                items.Add(o, o);
            }
            return(items);
        }
Exemple #8
0
        public override void Add(object key, object value)
        {
            _storage.Add(key, value);

            string s1 = key as string;
            string s2 = value as string;

            if (s1 != null && s2 != null)
            {
                Environment.SetEnvironmentVariable(s1, s2);
            }
        }
        public DebuggerDictionaryStorage(IDictionary<object, object> data) {
            Debug.Assert(data != null);

            _hidden = new CommonDictionaryStorage();
            foreach (var key in data.Keys) {
                string strKey = key as string;
                if (strKey != null && strKey.Length > 0 && strKey[0] == '$') {
                    _hidden.Add(strKey, null);
                }
            }

            _data = data;
        }
        public DebuggerDictionaryStorage(IDictionary <object, object> data)
        {
            Debug.Assert(data != null);

            _hidden = new CommonDictionaryStorage();
            foreach (var key in data.Keys)
            {
                if (key is string strKey && strKey.Length > 0 && strKey[0] == '$')
                {
                    _hidden.Add(strKey, null);
                }
            }

            _data = data;
        }
Exemple #11
0
        public AttributesDictionaryStorage(IAttributesCollection data)
        {
            Debug.Assert(data != null);

            _hidden = new CommonDictionaryStorage();
            foreach (var key in data.Keys)
            {
                string strKey = key as string;
                if (strKey != null && strKey.Length > 0 && strKey[0] == '$')
                {
                    _hidden.Add(strKey, null);
                }
            }

            _data = data;
        }
Exemple #12
0
 public void add(object o)
 {
     _items.Add(o, o);
 }
Exemple #13
0
 void ISet.PrivAdd(object adding)
 {
     PythonOps.Hash(DefaultContext.Default, adding);// make sure we're hashable
     _items.Add(adding, adding);
 }