示例#1
0
        private void OnDictionaryItemRemoved(string key)
        {
            if (DictionaryChanged != null)
            {
                var eventArgs = NotifyDictionaryChangedEventArgs <string, object> .ForRemoveAction(key);

                DictionaryChanged(this, eventArgs);
            }
        }
示例#2
0
        /// <summary>Removes an item from the instance.</summary>
        /// <param name="key">The key of the item to remove from the instance.</param>
        /// <returns><c>true</c> if the item was succesfully removed; otherwise, <c>false</c>.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="key" /> is <c>null</c>.</exception>
        /// <exception cref="NotSupportedException">The instance is <c>read-only</c>.</exception>
        public bool Remove(string key)
        {
            var removed = _items.Remove(key);

            if (removed)
            {
                OnDictionaryChanged(NotifyDictionaryChangedEventArgs <string, object> .ForRemoveAction(key));
            }

            return(removed);
        }
示例#3
0
        /// <summary>Removes an item from the instance.</summary>
        /// <param name="item">The item to remove from the instance.</param>
        /// <returns><c>true</c> if the item was succesfully removed; otherwise, <c>false</c>.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="item" />.<see cref="KeyValuePair{TKey, TValue}.Key" /> is <c>null</c>.</exception>
        /// <exception cref="NotSupportedException">The instance is <c>read-only</c>.</exception>
        bool ICollection <KeyValuePair <string, object> > .Remove(KeyValuePair <string, object> item)
        {
            var removed = _items.Remove(item);

            if (removed)
            {
                OnDictionaryChanged(NotifyDictionaryChangedEventArgs <string, object> .ForRemoveAction(item.Key));
            }

            return(removed);
        }