コード例 #1
0
        public static void Run()
        {
            var pizzaBuilder = new PizzaBuilder();
            var pizza        = pizzaBuilder
                               .SetCrust(Crust.Regular)
                               .SetSauce(Sauce.BBQ)
                               .AddTopping(Topping.GreenPeppers)
                               .AddTopping(Topping.Olives)
                               .MakePizza();

            Console.WriteLine("Pizza ingredients:");
            Console.WriteLine("Crust: " + pizza.Crust);
            Console.WriteLine("Sauce: " + pizza.Sauce);
            Console.Write("Toppings: ");
            foreach (Topping t in pizza.Toppings)
            {
                Console.Write(t + " ");
            }
            Console.WriteLine();
        }
コード例 #2
0
ファイル: Cook.cs プロジェクト: janeski/DesignPatterns
 public void SetPizzaBuilder(PizzaBuilder pb)
 {
     _pizzaBuilder = pb;
 }
コード例 #3
0
 public void SetPizzaBuilder(PizzaBuilder pb)
 {
     _pizzaBuilder = pb;
 }