Exemplo n.º 1
0
        static void Main(string[] args)
        {
            MenuDirector director = new MenuDirector();

            MenuBuilder builder1 = new BurgerMenuBuilder();

            director.Construct(builder1);
            Menu menu1 = builder1.GetResult();

            Console.WriteLine("Burger menu: {0}", menu1);

            MenuBuilder builder2 = new KidsMenuBuilder();

            director.Construct(builder2);
            Menu menu2 = builder2.GetResult();

            Console.WriteLine("Burger menu: {0}", menu2);

            MenuBuilder builder3 = new SaladMenuBuilder();

            director.Construct(builder3);
            Menu menu3 = builder3.GetResult();

            Console.WriteLine("Burger menu: {0}", menu3);
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            MenuDirector director = new MenuDirector();

            //create burger menu
            MenuBuilder builder1 = new BurgerMenuBuilder();

            director.Construct(builder1);
            Menu menu1 = builder1.GetResult();

            Console.WriteLine("Burger menu: {0}", menu1);

            //create kids menu
            MenuBuilder builder2 = new KidsMenuBuilder();

            director.Construct(builder2);
            Menu menu2 = builder2.GetResult();

            Console.WriteLine("Burger menu: {0}", menu2);

            //create salad menu
            MenuBuilder builder3 = new SaladMenuBuilder();

            director.Construct(builder3);
            Menu menu3 = builder3.GetResult();

            Console.WriteLine("Burger menu: {0}", menu3);

            //Result
            //Burger menu: Burger, Fries, Dessert, Drink
            //Burger menu: Burger, Fries, Drink, Toy
            //Burger menu: Salad, Dessert, Drink

            Console.ReadKey();
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            var director = new MenuDirector();


            var builder1 = new SaladMenuBuilder();

            director.Construct(builder: builder1);
            var menu = builder1.GetResult();

            Console.WriteLine("Salad Menu: {0}", menu);


            var builder2 = new HamburgerMenuBuilder();

            director.Construct(builder2);
            menu = builder2.GetResult();
            Console.WriteLine("Hamburger Menu: {0}", menu);
        }