Ejemplo n.º 1
0
        private static void Main(string[] args)
        {
            var director = new Director();
            Builder b1 = new ConcreteBuilder1();
            Builder b2 = new ConcreteBuilder2();

            director.Construct(b1);
            var p1 = b1.GetResult();
            p1.Show();

            director.Construct(b2);
            var p2 = b2.GetResult();
            p2.Show();

            Console.ReadKey();
        }
Ejemplo n.º 2
0
        public static void Main(string[] args)
        {
            _director = new Director();
            _vehicle  = new Vehicle();

            _builders = new List <Builder>()
            {
                new Tesla(),
                new Volkswagen(),
                new Yuedakia()
            };

            foreach (var builder in _builders)
            {
                _director.Construct(builder);
                _vehicle = builder.GetResult();
                _vehicle.Print();
            }

            Console.ReadKey();
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            try
            {
                TextBuilder textBuilder = new TextBuilder();
                Director    director    = new Director(textBuilder);
                director.Construct();
                string result = textBuilder.GetResult();
                WriteLine(result);

                HTMLBuilder htmlBuilder = new HTMLBuilder();
                Director    hDirector   = new Director(htmlBuilder);
                hDirector.Construct();
                string hResult = htmlBuilder.GetResult();
                WriteLine(hResult);

                ReadKey();
            }
            catch (Exception ex)
            {
                //throw;
            }
        }