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(); }
public void SetPizzaBuilder(PizzaBuilder pb) { _pizzaBuilder = pb; }