Beispiel #1
0
        static void Main(string[] args)
        {
            ObjectStructure objectStructure = new ObjectStructure();

            objectStructure.Add(new ConcreteElementA());
            objectStructure.Add(new ConcreteElementB());

            Visitor visitor1 = new ConcreteVisitorA();
            Visitor visitor2 = new ConcreteVisitorB();

            objectStructure.Accept(visitor1);
            objectStructure.Accept(visitor2);
            Console.ReadKey();
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            var structure = new ObjectStructure();

            structure.Add(new FirstElement());
            structure.Add(new SecondElement());

            var firstVisitor  = new FirstVisitor();
            var secondVisitor = new SecondVisitor();

            structure.Accept(firstVisitor);
            LogHelper.LogSeparator();
            structure.Accept(secondVisitor);

            Console.ReadLine();
        }