public void Add(TKey key, TValue value) { ThrowHelper.ThrowIfArgumentNullException(key, "key"); ThrowIfKeyExists(key); dict.Add(key, value); }
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; } }
public bool Remove(KeyValuePair <TKey, TValue> item) { ThrowHelper.ThrowIfArgumentNullException(item, "item"); ThrowHelper.ThrowIfArgumentNullException(item.Key, "item.Key"); return(dict.Remove(item)); }
void IDictionary.Add(object key, object value) { ThrowHelper.ThrowIfArgumentNullException(key, "key"); ThrowIfWrongKeyType(key); ThrowIfWrongValueType(value); Add((TKey)key, (TValue)value); }
void IDictionary.Remove(object key) { ThrowHelper.ThrowIfArgumentNullException(key, "key"); if (!(key is TKey)) { return; } Remove((TKey)key); }
bool IDictionary.Contains(object key) { ThrowHelper.ThrowIfArgumentNullException(key, "key"); if (!(key is TKey)) { return(false); } return(ContainsKey((TKey)key)); }
public TValue this[TKey key] { get { ThrowHelper.ThrowIfArgumentNullException(key, "key"); return(dict[key]); } set { ThrowHelper.ThrowIfArgumentNullException(key, "key"); dict[key] = value; } }
public bool TryGetValue(TKey key, out TValue value) { ThrowHelper.ThrowIfArgumentNullException(key, "key"); return(dict.TryGetValue(key, out value)); }
public bool Remove(TKey key) { ThrowHelper.ThrowIfArgumentNullException(key, "key"); return(dict.Remove(key)); }
public bool ContainsKey(TKey key) { ThrowHelper.ThrowIfArgumentNullException(key, "key"); return(dict.ContainsKey(key)); }
public void Add(KeyValuePair <TKey, TValue> item) { ThrowHelper.ThrowIfArgumentNullException(item, "item"); ThrowIfKeyExists(item.Key); dict.Add(item); }