Exemplo n.º 1
0
        static void Main(string[] args)
        {
            IArabaBuilder araba = new OpelConcreteBuilder();
            ArabaUret     uret  = new ArabaUret();

            uret.Uret(araba);

            Console.WriteLine(araba.Araba.ToString());

            araba = new ToyotaConcreteBuilder();
            uret.Uret(araba);
            Console.WriteLine(araba.Araba.ToString());

            Console.Read();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            /// example1
            IBuilderMobilePhone builderMobilePhone = new AndroidMobilePhone();
            DirectorMobilePhone mobilePhone        = new DirectorMobilePhone(builderMobilePhone);

            mobilePhone.Construction();
            Console.WriteLine(builderMobilePhone.GetMobilePhone().ToString());


            /// example2
            ICarBuilder carBuilder = new OpelConcreteBuilder();
            DirectorCar car        = new DirectorCar();

            car.Construction(carBuilder);
            Console.WriteLine(carBuilder.Car.ToString());


            /// example 3
            MesajDirector mesaj = new MesajDirector();

            mesaj.Construction(new DogumGunuTebrikBuilder());
            mesaj.Show();
            MesajBuilder builder = new BayramTebrikMesajBuilder();

            mesaj.Construction(builder);
            mesaj.Show();


            /// exampl4
            var pizzaOrder = new PizzaBuilder(Size.Medium)
                             .AddCheese()
                             .AddHam()
                             .AddMushrooms()
                             .AddOlives()
                             .AddPepperoni()
                             .AddSauce();

            Console.WriteLine("Size : {0}, Sauce : {1}, Pepperoni : {2}, Olives : {3}, Pepperoni : {4}, Ham : {5}", pizzaOrder.Size, pizzaOrder.Sauce, pizzaOrder.Pepperoni, pizzaOrder.Olives, pizzaOrder.Mushrooms, pizzaOrder.Ham);
            Console.ReadLine();
        }