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);
     }
 }
Beispiel #3
0
 public bool TryAdd(T item)
 {
     lock (Lock)
     {
         if (ConcurrentHashSet.Add(item))
         {
             HashSetChanged?.Invoke(this, EventArgs.Empty);
             return(true);
         }
         return(false);
     }
 }