/// <inheritdoc />
        public override void Add(KeyValuePair <TKey, TValue> item)
        {
            ICollectionContracts.Add(this);

            if (this.addValue(item))
            {
                this.Dictionary.Add(item);
            }
        }
        /// <inheritdoc />
        public void CopyTo(KeyValuePair <TIndex, TValue>[] array, int arrayIndex)
        {
            ICollectionContracts.CopyTo(this, array, arrayIndex);

            foreach (KeyValuePair <TIndex, TValue> entry in this)
            {
                array[arrayIndex] = entry;
                arrayIndex++;
            }
        }
        /// <inheritdoc />
        public void Clear()
        {
            ICollectionContracts.Clear(this);

            foreach (var entry in this.indexable)
            {
                this.indexable[entry.Key] = TryValue.None <TValue>();
            }

            this.count = 0;
        }
        /// <inheritdoc />
        public bool Remove(KeyValuePair <TIndex, TValue> item)
        {
            ICollectionContracts.Remove(this);

            if (!this.Contains(item))
            {
                return(false);
            }

            this.indexable[item.Key] = TryValue.None <TValue>();
            this.count--;
            return(true);
        }
Ejemplo n.º 5
0
        /// <inheritdoc />
        public void Add(T item)
        {
            ICollectionContracts.Add(this);

            int count;

            if (this.countPerItem.TryGetValue(item, out count))
            {
                this.countPerItem[item] = count + 1;
            }
            else
            {
                this.countPerItem[item] = 1;
            }
        }
Ejemplo n.º 6
0
        /// <inheritdoc />
        public bool Remove(T item)
        {
            ICollectionContracts.Remove(this);

            int count;

            if (this.countPerItem.TryGetValue(item, out count))
            {
                if (count > 1)
                {
                    this.countPerItem[item] = count - 1;
                }
                else
                {
                    this.countPerItem.Remove(item);
                }

                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 7
0
        /// <inheritdoc />
        public void CopyTo(T[] array, int arrayIndex)
        {
            ICollectionContracts.CopyTo(this, array, arrayIndex);

            this.countPerItem.Keys.CopyTo(array, arrayIndex);
        }
Ejemplo n.º 8
0
        /// <inheritdoc />
        public bool Remove(TBase item)
        {
            ICollectionContracts.Remove <TBase>(this);

            return(this.values.Remove(new KeyValuePair <Type, TBase>(item?.GetType(), item)));
        }
Ejemplo n.º 9
0
        /// <inheritdoc />
        public bool Remove(Type key)
        {
            ICollectionContracts.Remove <KeyValuePair <Type, TBase> >(this);

            return(this.values.Remove(key));
        }
Ejemplo n.º 10
0
        /// <inheritdoc />
        public void CopyTo(TBase[] array, int arrayIndex)
        {
            ICollectionContracts.CopyTo(this, array, arrayIndex);

            this.values.Values.CopyTo(array, arrayIndex);
        }
Ejemplo n.º 11
0
        /// <inheritdoc />
        public void CopyTo(KeyValuePair <Type, TBase>[] array, int arrayIndex)
        {
            ICollectionContracts.CopyTo(this, array, arrayIndex);

            this.values.CopyTo(array, arrayIndex);
        }
Ejemplo n.º 12
0
        /// <inheritdoc />
        void ICollection <IDisposable> .Add(IDisposable item)
        {
            ICollectionContracts.Add(this);

            this.Add(item);
        }
        /// <inheritdoc />
        public void Add(KeyValuePair <TIndex, TValue> item)
        {
            ICollectionContracts.Add(this);

            this.dictionary.Add(item);
        }
Ejemplo n.º 14
0
        /// <inheritdoc />
        public void Clear()
        {
            ICollectionContracts.Clear(this);

            this.countPerItem.Clear();
        }
Ejemplo n.º 15
0
        /// <inheritdoc />
        public bool Remove(T item)
        {
            ICollectionContracts.Remove(this);

            return(this.instances.Remove(item));
        }
        /// <inheritdoc />
        public void Add(KeyValuePair <TIndex, TValue> item)
        {
            ICollectionContracts.Add(this);

            this.Add(item.Key, item.Value);
        }
Ejemplo n.º 17
0
        /// <inheritdoc />
        public void CopyTo(T[] array, int arrayIndex)
        {
            ICollectionContracts.CopyTo(this, array, arrayIndex);

            this.instances.Keys.CopyTo(array, arrayIndex);
        }
Ejemplo n.º 18
0
        /// <inheritdoc />
        public void Clear()
        {
            ICollectionContracts.Clear(this);

            this.instances.Clear();
        }
Ejemplo n.º 19
0
        /// <inheritdoc />
        void ICollection <T> .Add(T item)
        {
            ICollectionContracts.Add(this);

            this.Add(item);
        }
Ejemplo n.º 20
0
        /// <inheritdoc />
        public void CopyTo(IDisposable[] array, int arrayIndex)
        {
            ICollectionContracts.CopyTo(this, array, arrayIndex);

            this.disposables.CopyTo(array, arrayIndex);
        }
Ejemplo n.º 21
0
        /// <inheritdoc />
        public void Clear()
        {
            ICollectionContracts.Clear(this);

            this.disposables.Clear();
        }
        /// <inheritdoc />
        public void Clear()
        {
            ICollectionContracts.Clear(this);

            this.dictionary.Clear();
        }
        /// <inheritdoc />
        public virtual void Add(KeyValuePair <TKey, TValue> item)
        {
            ICollectionContracts.Add(this);

            this.Dictionary.Add(item);
        }
        /// <inheritdoc />
        public virtual bool Remove(KeyValuePair <TKey, TValue> item)
        {
            ICollectionContracts.Remove(this);

            return(this.Dictionary.Remove(item));
        }
Ejemplo n.º 25
0
        /// <inheritdoc />
        public void Clear()
        {
            ICollectionContracts.Clear <KeyValuePair <Type, TBase> >(this);

            this.values.Clear();
        }
        /// <inheritdoc />
        public bool Remove(KeyValuePair <TIndex, TValue> item)
        {
            ICollectionContracts.Remove(this);

            return(this.dictionary.Remove(item));
        }
Ejemplo n.º 27
0
        /// <inheritdoc />
        public bool Remove(IDisposable item)
        {
            ICollectionContracts.Remove(this);

            return(this.disposables.Remove(item));
        }
        /// <inheritdoc />
        public void CopyTo(KeyValuePair <TIndex, TValue>[] array, int arrayIndex)
        {
            ICollectionContracts.CopyTo(this, array, arrayIndex);

            this.dictionary.CopyTo(array, arrayIndex);
        }
        /// <inheritdoc />
        public virtual void Clear()
        {
            ICollectionContracts.Clear(this);

            this.Dictionary.Clear();
        }