Example #1
0
        static void Main(string[] args)
        {
            Handler h1 = new FirstHandler();
            Handler h2 = new SecondHandler();

            h1.SetSuccessor(h2);

            h1.HandleRequest(9);
            h1.HandleRequest(15);

            Console.Read();
        }
Example #2
0
        static void Main(string[] args)
        {
            //define the handlers.
            Handler firstHandler  = new FirstHandler();
            Handler secondHandler = new SecondHandler();


            //Assign the first handler successor to the Second Handler.
            firstHandler.SetNextSuccessor(secondHandler);

            Console.WriteLine("Input your request");
            string request = Console.ReadLine();

            firstHandler.HandleRequest(Convert.ToInt16(request));
            Console.ReadKey();
        }