public Burger(BurgerBuilder builder)
 {
     this.size    = builder.size;
     this.cheese  = builder.cheese;
     this.ketchup = builder.ketchup;
     this.sauce   = builder.sauce;
 }
Exemple #2
0
 public Burger(BurgerBuilder builder)
 {
     mSize      = builder.Size;
     mCheese    = builder.Cheese;
     mPepperoni = builder.Pepperoni;
     mLettuce   = builder.Lettuce;
     mTomato    = builder.Tomato;
 }
 public Burger(BurgerBuilder builder)
 {
     this.size      = builder.Size;
     this.cheese    = builder.Cheese;
     this.pepperoni = builder.Pepperoni;
     this.lettuce   = builder.Lettuce;
     this.tomato    = builder.Tomato;
 }
        static void Main(string[] args)
        {
            var burger = new BurgerBuilder(4).AddCheese()
                         .AddSauce()
                         .Build();

            burger.GetDescription();
            Console.ReadKey();
        }
Exemple #5
0
        static void Main(string[] args)
        {
            var burgerBuilder = new BurgerBuilder(24);

            var burger = burgerBuilder.AddCheese()
                         .AddPepperoni()
                         .AddTomato()
                         .Build();

            burger.Description();
        }
Exemple #6
0
        /// <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());
        }