public void Clear() { lock (Lock) { if (Set.Count > 0) { Set.Clear(); HashSetChanged?.Invoke(this, EventArgs.Empty); } } }
public bool TryRemove(T item) { lock (Lock) { if (Set.TryRemove(item)) { HashSetChanged?.Invoke(this, EventArgs.Empty); return(true); } return(false); } }
public bool TryAdd(T item) { lock (Lock) { if (ConcurrentHashSet.Add(item)) { HashSetChanged?.Invoke(this, EventArgs.Empty); return(true); } return(false); } }