コード例 #1
0
        public int RegisterSingle(int instances)
        {
            var hub = new EventHub();

            for (var i = 0; i < instances; i++)
            {
                var handler = new SyncBaseCountingHandler();
                hub.Register(handler);
            }

            return(hub.GetRegisteredHandlers <BaseEvent>().Count());
        }
コード例 #2
0
        public int DerivedClassMatchHandled(int iterations)
        {
            var hub     = new EventHub();
            var handler = new SyncBaseCountingHandler();

            hub.Register(handler);

            for (var i = 0; i < iterations; i++)
            {
                hub.AddEvent(new DerivedEvent());
                hub.AddEvent(42); //Should not handle this
            }

            return(handler.HandleCount);
        }