Ejemplo n.º 1
0
        public void Add(TKey key, TValue value)
        {
            ThrowHelper.ThrowIfArgumentNullException(key, "key");
            ThrowIfKeyExists(key);

            dict.Add(key, value);
        }
Ejemplo n.º 2
0
        object IDictionary.this[object key]
        {
            get
            {
                ThrowHelper.ThrowIfArgumentNullException(key, "key");
                if (!(key is TKey))
                {
                    return(null);
                }
                TValue val;

                if (!TryGetValue((TKey)key, out val))
                {
                    return(null);
                }

                return(val);
            }
            set
            {
                ThrowHelper.ThrowIfArgumentNullException(key, "key");
                ThrowIfWrongKeyType(key);
                ThrowIfWrongValueType(value);
                this[(TKey)key] = (TValue)value;
            }
        }
Ejemplo n.º 3
0
        public bool Remove(KeyValuePair <TKey, TValue> item)
        {
            ThrowHelper.ThrowIfArgumentNullException(item, "item");
            ThrowHelper.ThrowIfArgumentNullException(item.Key, "item.Key");

            return(dict.Remove(item));
        }
Ejemplo n.º 4
0
        void IDictionary.Add(object key, object value)
        {
            ThrowHelper.ThrowIfArgumentNullException(key, "key");
            ThrowIfWrongKeyType(key);
            ThrowIfWrongValueType(value);

            Add((TKey)key, (TValue)value);
        }
Ejemplo n.º 5
0
 void IDictionary.Remove(object key)
 {
     ThrowHelper.ThrowIfArgumentNullException(key, "key");
     if (!(key is TKey))
     {
         return;
     }
     Remove((TKey)key);
 }
Ejemplo n.º 6
0
 bool IDictionary.Contains(object key)
 {
     ThrowHelper.ThrowIfArgumentNullException(key, "key");
     if (!(key is TKey))
     {
         return(false);
     }
     return(ContainsKey((TKey)key));
 }
Ejemplo n.º 7
0
 public TValue this[TKey key]
 {
     get
     {
         ThrowHelper.ThrowIfArgumentNullException(key, "key");
         return(dict[key]);
     }
     set
     {
         ThrowHelper.ThrowIfArgumentNullException(key, "key");
         dict[key] = value;
     }
 }
Ejemplo n.º 8
0
 public bool TryGetValue(TKey key, out TValue value)
 {
     ThrowHelper.ThrowIfArgumentNullException(key, "key");
     return(dict.TryGetValue(key, out value));
 }
Ejemplo n.º 9
0
 public bool Remove(TKey key)
 {
     ThrowHelper.ThrowIfArgumentNullException(key, "key");
     return(dict.Remove(key));
 }
Ejemplo n.º 10
0
 public bool ContainsKey(TKey key)
 {
     ThrowHelper.ThrowIfArgumentNullException(key, "key");
     return(dict.ContainsKey(key));
 }
Ejemplo n.º 11
0
 public void Add(KeyValuePair <TKey, TValue> item)
 {
     ThrowHelper.ThrowIfArgumentNullException(item, "item");
     ThrowIfKeyExists(item.Key);
     dict.Add(item);
 }