예제 #1
0
        static void Main(string[] args)
        {
            Director director = new Director();

            Builder builderA = new ConcreteBuilderA();
            Builder builderB = new ConcreteBuilderB();

            director.Construct(builderA);
            var productA = builderA.GetProduct();

            productA.Display();

            director.Construct(builderB);
            var productB = builderB.GetProduct();

            productB.Display();

            // Output:
            // Product Type A --------
            //   PartA1
            //   PartA2
            //   PartA3
            // Product Type B --------
            //   PartB1
            //   PartB2
            //   PartB3
        }
예제 #2
0
        static void Main(string[] args)
        {
            Builder  createrA = new ConcreteBuilderA();
            Director director = new Director(createrA);
            Product  proA     = director.createProduct();

            proA.show();
            Console.Read();
        }
예제 #3
0
        private static void Main()
        {
            var director = new Director();

            var builderA = new ConcreteBuilderA();
            var builderB = new ConcreteBuilderB();

            director.Construct(builderA);
            var productA = builderA.GetResult();

            productA.Show();

            director.Construct(builderB);
            var productB = builderB.GetResult();

            productB.Show();

            Console.ReadKey();
        }