Exemplo n.º 1
0
        private static void ChainOfResponsibilityExample()
        {
            var handlerOne = new ConcreteHandlerOne();
            var handlerTwo = new ConcreteHandlerTwo();

            handlerOne.SetSuccessor(handlerTwo);
            handlerTwo.SetSuccessor(handlerOne);

            handlerOne.HandleRequest("PrintDate");
            handlerOne.HandleRequest("PrintGreeting");
        }
Exemplo n.º 2
0
        public UseCase()
        {
            AbstractHandler handler1 = new ConcreteHandlerOne();

            handler1.Successor = new ConcreteHandlerTwo();
            handler1.HandleRequest(2);
        }