public void SetDirty() { if (Inited) { GotDirty?.Invoke(this, this); } }
public TValue this[TKey key] { get { lock (map) { return(map[key]); } } set { lock (map) { if (!map.ContainsKey(key) || (map[key] == null && value != null) || value is State || map[key].CompareTo(value) != 0) { map[key] = value; if (!Dirty) { Dirty = true; GotDirty?.Invoke(this, EventArgs.Empty); } } } } }
public void Add(TKey key, TValue value) { lock (map) { map.Add(key, value); if (!Dirty) { Dirty = true; GotDirty?.Invoke(this, EventArgs.Empty); } } }
public void Clear() { lock (map) { map.Clear(); if (!Dirty) { Dirty = true; GotDirty?.Invoke(this, EventArgs.Empty); } } }
public bool Remove(TKey key) { lock (map) { bool removed = map.Remove(key); if (removed && !Dirty) { Dirty = true; GotDirty?.Invoke(this, EventArgs.Empty); } return(removed); } }