コード例 #1
0
        /// <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);
        }
コード例 #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;
            }
        }
コード例 #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);
            }
        }
コード例 #7
0
        /// <inheritdoc />
        public void CopyTo(T[] array, int arrayIndex)
        {
            ICollectionContracts.CopyTo(this, array, arrayIndex);

            this.countPerItem.Keys.CopyTo(array, arrayIndex);
        }
コード例 #8
0
        /// <inheritdoc />
        public bool Remove(TBase item)
        {
            ICollectionContracts.Remove <TBase>(this);

            return(this.values.Remove(new KeyValuePair <Type, TBase>(item?.GetType(), item)));
        }
コード例 #9
0
        /// <inheritdoc />
        public bool Remove(Type key)
        {
            ICollectionContracts.Remove <KeyValuePair <Type, TBase> >(this);

            return(this.values.Remove(key));
        }
コード例 #10
0
        /// <inheritdoc />
        public void CopyTo(TBase[] array, int arrayIndex)
        {
            ICollectionContracts.CopyTo(this, array, arrayIndex);

            this.values.Values.CopyTo(array, arrayIndex);
        }
コード例 #11
0
        /// <inheritdoc />
        public void CopyTo(KeyValuePair <Type, TBase>[] array, int arrayIndex)
        {
            ICollectionContracts.CopyTo(this, array, arrayIndex);

            this.values.CopyTo(array, arrayIndex);
        }
コード例 #12
0
        /// <inheritdoc />
        void ICollection <IDisposable> .Add(IDisposable item)
        {
            ICollectionContracts.Add(this);

            this.Add(item);
        }
コード例 #13
0
        /// <inheritdoc />
        public void Add(KeyValuePair <TIndex, TValue> item)
        {
            ICollectionContracts.Add(this);

            this.dictionary.Add(item);
        }
コード例 #14
0
        /// <inheritdoc />
        public void Clear()
        {
            ICollectionContracts.Clear(this);

            this.countPerItem.Clear();
        }
コード例 #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);
        }
コード例 #17
0
        /// <inheritdoc />
        public void CopyTo(T[] array, int arrayIndex)
        {
            ICollectionContracts.CopyTo(this, array, arrayIndex);

            this.instances.Keys.CopyTo(array, arrayIndex);
        }
コード例 #18
0
        /// <inheritdoc />
        public void Clear()
        {
            ICollectionContracts.Clear(this);

            this.instances.Clear();
        }
コード例 #19
0
        /// <inheritdoc />
        void ICollection <T> .Add(T item)
        {
            ICollectionContracts.Add(this);

            this.Add(item);
        }
コード例 #20
0
        /// <inheritdoc />
        public void CopyTo(IDisposable[] array, int arrayIndex)
        {
            ICollectionContracts.CopyTo(this, array, arrayIndex);

            this.disposables.CopyTo(array, arrayIndex);
        }
コード例 #21
0
        /// <inheritdoc />
        public void Clear()
        {
            ICollectionContracts.Clear(this);

            this.disposables.Clear();
        }
コード例 #22
0
        /// <inheritdoc />
        public void Clear()
        {
            ICollectionContracts.Clear(this);

            this.dictionary.Clear();
        }
コード例 #23
0
        /// <inheritdoc />
        public virtual void Add(KeyValuePair <TKey, TValue> item)
        {
            ICollectionContracts.Add(this);

            this.Dictionary.Add(item);
        }
コード例 #24
0
        /// <inheritdoc />
        public virtual bool Remove(KeyValuePair <TKey, TValue> item)
        {
            ICollectionContracts.Remove(this);

            return(this.Dictionary.Remove(item));
        }
コード例 #25
0
        /// <inheritdoc />
        public void Clear()
        {
            ICollectionContracts.Clear <KeyValuePair <Type, TBase> >(this);

            this.values.Clear();
        }
コード例 #26
0
        /// <inheritdoc />
        public bool Remove(KeyValuePair <TIndex, TValue> item)
        {
            ICollectionContracts.Remove(this);

            return(this.dictionary.Remove(item));
        }
コード例 #27
0
        /// <inheritdoc />
        public bool Remove(IDisposable item)
        {
            ICollectionContracts.Remove(this);

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

            this.dictionary.CopyTo(array, arrayIndex);
        }
コード例 #29
0
        /// <inheritdoc />
        public virtual void Clear()
        {
            ICollectionContracts.Clear(this);

            this.Dictionary.Clear();
        }