Пример #1
0
        public static void Unsubscribe <T>(Action <T> handler)
        {
            Subscriber anonymousSubscriber = new AnonymousSubscriber <T>(handler);

            subscribers.TryRemove(anonymousSubscriber.GetHashCode(),
                                  out anonymousSubscriber);
        }
Пример #2
0
        public static void Subscribe <T>(Action <T> handler)
        {
            var anonymousSubscriber = new AnonymousSubscriber <T>(handler);

            subscribers.TryAdd(anonymousSubscriber.GetHashCode(), anonymousSubscriber);
        }