Mid From PDF GoF Patterns Gang of Four Patterns

Director (PizzaDirector):?

  • The PizzaDirector class orchestrates the pizza building process. It uses a

builder to construct a specific type of pizza (like Margherita) by calling the

appropriate methods on the builder. It then returns the final product.

Follow:

public class PizzaDirector

private readonly IPizzaBuilder _builder;

public PizzaDirector(IPizzaBuilder builder) => _builder =

builder;

public Pizza ConstructMargheritaPizza()

_builder.SetDough("Thin Crust");

_builder.SetSauce("Tomato");

_builder.AddTopping("Mozzarella");

return _builder.Build();

More from Design Patterns in C#

All questions for this course
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details