コード例 #1
0
        public static void Handle(string email)
        {
            // Create the handler objects...
            IEmailHandler spam    = new SpamEmailHandler();
            IEmailHandler sales   = new SalesEmailHandler();
            IEmailHandler service = new ServiceEmailHandler();
            IEmailHandler manager = new ManagerEmailHandler();
            IEmailHandler general = new GeneralEnquiriesEmailHandler();

            // Chain them together...
            spam.NextHandler    = sales;
            sales.NextHandler   = service;
            service.NextHandler = manager;
            manager.NextHandler = general;

            // Start the ball rolling...
            spam.ProcessHandler(email);
        }
コード例 #2
0
        public static void Handle(string email)
        {
            // Create the handler objects...
            IEmailHandler spam = new SpamEmailHandler();
            IEmailHandler sales = new SalesEmailHandler();
            IEmailHandler service = new ServiceEmailHandler();
            IEmailHandler manager = new ManagerEmailHandler();
            IEmailHandler general = new GeneralEnquiriesEmailHandler();

            // Chain them together...
            spam.NextHandler = sales;
            sales.NextHandler = service;
            service.NextHandler = manager;
            manager.NextHandler = general;

            // Start the ball rolling...
            spam.ProcessHandler(email);
        }