Exemple #1
0
        void IDictionary.Add(object key, object value)
        {
            Dictionary <TKey, TValue> .VerifyKey(key);

            Dictionary <TKey, TValue> .VerifyValueType(value);

            this.Add((TKey)key, (TValue)value);
        }
Exemple #2
0
        object IDictionary.this[object key]
        {
            get
            {
                if (Dictionary <TKey, TValue> .IsCompatibleKey(key))
                {
                    int index = this.FindEntry((TKey)key);
                    if (index >= 0)
                    {
                        return(this.entries[index].value);
                    }
                }
                return(null);
            }
            set
            {
                Dictionary <TKey, TValue> .VerifyKey(key);

                Dictionary <TKey, TValue> .VerifyValueType(value);

                this[(TKey)key] = (TValue)value;
            }
        }