DEV Community

Discussion on: Builder Design Pattern

Collapse
 
miffpengi profile image
Miff

If you don't need your properties to be necessarily set at creation, you can also set properties when constructing the object in C# even if they're not in the constructor.

var burger = new Burger(14){ Cheese = true, Tomato = true, Lettuce = false, Pepperoni = false };
Enter fullscreen mode Exit fullscreen mode