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 }
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(); }