System.Collections.Generic.HashSet.Add(Watcher)

Here are the examples of the csharp api System.Collections.Generic.HashSet.Add(Watcher) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

3 Examples 7

19 Source : WatchRegistration.cs
with MIT License
from brucehu123

public void Register()
        {
            var watches = Gereplacedches();
            lock (watches)
            {
                HashSet<Watcher> watchers;
                watches.TryGetValue(clientPath, out watchers);
                if (watchers == null)
                {
                    watchers = new HashSet<Watcher>();
                    watches[clientPath] = watchers;
                }
                if (!watchers.Any(w => w.GetType() == watcher.GetType()))
                    watchers.Add(watcher);
            }
        }

19 Source : WatchRegistration.cs
with MIT License
from fanliang11

public void Register()
        {
            var watches = Gereplacedches();
            lock (watches)
            {
                HashSet<Watcher> watchers;
                watches.TryGetValue(clientPath, out watchers);
                if (watchers == null)
                {
                    watchers = new HashSet<Watcher>();
                    watches[clientPath] = watchers;
                }
               if (!watchers.Any(p => p.GetType() == watcher.GetType()))
                watchers.Add(watcher);
            }
        }

19 Source : WatchRegistration.cs
with GNU General Public License v3.0
from microsurging

public void Register()
        {
            var watches = Gereplacedches();

            HashSet<Watcher> watchers;
            watches.TryGetValue(clientPath, out watchers);
            if (watchers == null)
            {
                watchers = new HashSet<Watcher>();
                watches[clientPath] = watchers;
            }
            if (!watchers.Any(p => p.GetType() == watcher.GetType()))
                watchers.Add(watcher);

        }