コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="COR"/> class.
        /// </summary>
        public COR()
        {
            Handler imageHandler    = new ConcreteHandlerImage();
            Handler videoHandler    = new ConcreteHandlerVideo();
            Handler documentHandler = new ConcreteHandlerDocument();
            Handler otherHandler    = new ConcreteHandlerOther();
            Handler mailHandler     = new ConcreteHandlerMail();

            mailHandler.SetSuccessor(documentHandler);
            documentHandler.SetSuccessor(imageHandler);
            imageHandler.SetSuccessor(videoHandler);
            videoHandler.SetSuccessor(otherHandler);

            handle = mailHandler;
        }
コード例 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="COR"/> class.
        /// </summary>
        public COR()
        {
            Handler imageHandler = new ConcreteHandlerImage();
            Handler videoHandler = new ConcreteHandlerVideo();
            Handler documentHandler = new ConcreteHandlerDocument();
            Handler otherHandler = new ConcreteHandlerOther();
            Handler mailHandler = new ConcreteHandlerMail();

            mailHandler.SetSuccessor(documentHandler);
            documentHandler.SetSuccessor(imageHandler);
            imageHandler.SetSuccessor(videoHandler);
            videoHandler.SetSuccessor(otherHandler);

            handle = mailHandler;
            
        }