Example #1
0
        public virtual void Add(string key, T item)
        {
            if (_keys.Contains(key))
            {
                throw new Exception("Key already exist");
            }
            _keys.Add(key);
            int index = _items.Add(item);

            if (ItemAdd != null)
            {
                ItemAdd(this, new KeyedCollectionAddEventArgs(_items[index], index, _keys[index]));
            }
            if (CollectionChanged != null)
            {
                CollectionChanged(this, new EventArgs());
            }
        }
Example #2
0
 public virtual bool Contains(T item)
 {
     return(_items.Contains(item));
 }