static void Main(string[] args) { var burger = new BurgerBuilder(4).AddCheese() .AddSauce() .Build(); burger.GetDescription(); Console.ReadKey(); }
/// <summary> /// When there could be several flavors of an object and to avoid the constructor telescoping. /// The key difference from the factory pattern is that; factory pattern is to be used when /// the creation is a one step process while builder pattern is to be used when the creation is a multi step process. /// </summary> private static void Main() { var burger = new BurgerBuilder(4).AddCheese().AddPepperoni().AddLettuce().AddTomato().Build(); Console.WriteLine(burger.GetDescription()); }