public bool Add(T key) { bool added = _items.Add(key); if (added) { AfterKeyAdded?.Invoke(this, new KeyEventArg <T>(key)); } return(added); }
public TI this[TK key] { get { return(_items[key]); } set { if (!_items.ContainsKey(key) && !_items.ContainsValue((T)value)) { _items[key] = (T)value; value.PropertyChanged += Value_PropertyChanged; AfterKeyAdded?.Invoke(this, new KeyEventArg <TK>(key)); } } }