コード例 #1
0
        void Run1()
        {
            var dispatcher = new Dispatcher1();
            dispatcher.Register<SayHelloCommand>(
                new SayHelloExecutor(
                    new ConsolePrinterWithTime(
                        new UtcClock(), new ConsolePrinter())).Handle);

            //.................
            dispatcher.Dispatch(new SayHelloCommand("Tom"));
        }
コード例 #2
0
        void Run2()
        {
            var dispatcher = new Dispatcher1();
            dispatcher.Register<SayHelloCommand>(
                command =>
                    GreetingsExecutors
                    .Handle(command,
                        new ConsolePrinterWithTime(new UtcClock(), new ConsolePrinter())));

            //.................
            dispatcher.Dispatch(new SayHelloCommand("Tom"));
        }