コード例 #1
0
        static void Main(string[] args)
        {
            // Elementler
            Control pnl = new Panel();
            Control ddl = new DropDownList();
            Control txt = new TextBox();

            // Visitorlar
            IVisitor cv = new ControlsVisitor();

            pnl.Accept(cv);
            ddl.Accept(cv);
            txt.Accept(cv);

            IVisitor sv = new StateFullVisitor();

            pnl.Accept(sv);
            ddl.Accept(sv);
            txt.Accept(sv);

            Console.ReadKey();
        }