static void Main(string[] args) { VehicleBuilder builder; // Create shop with vehicle builders Shop shop = new Shop(); // Construct and display vehicles builder = new ScooterBuilder(); shop.Construct(builder); builder.Vehicle.Show(); builder = new CarBuilder(); shop.Construct(builder); builder.Vehicle.Show(); builder = new MotorCycleBuilder(); shop.Construct(builder); builder.Vehicle.Show(); // Wait for user Console.ReadKey(); }
static void Main(string[] args) { var car = new CarBuilder(); var motorCycle = new MotorCycleBuilder(); var shop = new Shop(); shop.Construct(car); car.Vehicle.Show(); Console.WriteLine("---------------"); shop.Construct(motorCycle); motorCycle.Vehicle.Show(); }
static void Main(string[] args) { VehicleBuilder builder; Shop shop = new Shop(); builder = new ScooterBuilder(); shop.Construct(builder); builder.Vehicle.Show(); builder = new MotorCycleBuilder(); shop.Construct(builder); builder.Vehicle.Show(); Console.ReadKey(); }
internal static void Main() { VehicleBuilder builder; var shop = new Shop(); builder = new ScooterBuilder(); shop.Construct(builder); builder.Vehicle.Show(); builder = new CarBuilder(); shop.Construct(builder); builder.Vehicle.Show(); builder = new MotorCycleBuilder(); shop.Construct(builder); builder.Vehicle.Show(); }
internal static void Main() { VehicleBuilder builder; var shop = new Shop(); builder = new ScooterBuilder(); shop.Construct(builder); builder.Vehicle.Show(); builder = new CarBuilder(); shop.Construct(builder); builder.Vehicle.Show(); builder = new MotorCycleBuilder(); shop.Construct(builder); builder.Vehicle.Show(); }
private static void Main() { VehicleBuilder builder; var shop = new Shop(); builder = new ScooterBuilder(); shop.Construct(builder); builder.Vehicle.Show(); builder = new CarBuilder(); shop.Construct(builder); builder.Vehicle.Show(); builder = new MotorCycleBuilder(); shop.Construct(builder); builder.Vehicle.Show(); Console.ReadKey(); }
/// <summary> /// Entry point into console application. /// </summary> public static void Main() { VehicleBuilder builder; // Create shop with vehicle builders Shop shop = new Shop(); // Construct and display vehicles builder = new ScooterBuilder(); shop.Construct(builder); builder.Vehicle.Show(); builder = new CarBuilder(); shop.Construct(builder); builder.Vehicle.Show(); builder = new MotorCycleBuilder(); shop.Construct(builder); builder.Vehicle.Show(); // Wait for user Console.ReadKey(); }
public static void Run() { Console.WriteLine("This real-world code demonstates the Builder pattern in which different vehicles are assembled in a step-by-step fashion. The Shop uses VehicleBuilders to construct a variety of Vehicles in a series of sequential steps."); VehicleBuilder builder; Shop shop = new Shop(); builder = new ScooterBuilder(); shop.Construct(builder); builder.Vehicle.Show(); builder = new CarBuilder(); shop.Construct(builder); builder.Vehicle.Show(); builder = new MotorCycleBuilder(); shop.Construct(builder); builder.Vehicle.Show(); /* * --------------------------- * Vehicle Type: Scooter * Frame : Scooter Frame * Engine : none #Wheels: 2 #Doors : 0 * * --------------------------- * Vehicle Type: Car * Frame : Car Frame * Engine : 2500 cc #Wheels: 4 #Doors : 4 * * --------------------------- * Vehicle Type: MotorCycle * Frame : MotorCycle Frame * Engine : 500 cc #Wheels: 2 #Doors : 0 */ }
static void Main(string[] args) { VehicleBuilder builder; Shop shop = new Shop(); builder = new ScooterBuilder(); shop.Construct(builder); builder.Vehicle.Show(); builder = new MotorCycleBuilder(); shop.Construct(builder); builder.Vehicle.Show(); builder = new CarBuilder(); shop.Construct(builder); builder.Vehicle.Show(); Console.ReadKey(); }
public static void Main() { VehicleBuilder builder; // Create shop with vehicle builders Shop shop = new Shop(); // Construct and display vehicles builder = new ScooterBuilder(); shop.Construct(builder); builder.Vehicle.Show(); builder = new CarBuilder(); shop.Construct(builder); builder.Vehicle.Show(); builder = new MotorCycleBuilder(); shop.Construct(builder); builder.Vehicle.Show(); }
static void Main(string[] args) { BuildingBuilder builder; Shop shop = new Shop(); builder = new HouseBuilder(); shop.Construct(builder); builder.Building.Show(); builder = new MultiFamilyHouseBuilder(); shop.Construct(builder); builder.Building.Show(); builder = new SkyscraperBuilder(); shop.Construct(builder); builder.Building.Show(); Console.ReadKey(); }
static void Main(string[] args) { TostBuilder builder; Shop shop = new Shop(); builder = new KarisikBuilder(); shop.Construct(builder); builder.Tost.Show(); builder = new KasarliBuilder(); shop.Construct(builder); builder.Tost.Show(); builder = new AyvalikBuilder(); shop.Construct(builder); builder.Tost.Show(); Console.ReadKey(); }
static void Main(string[] args) { // different builders MotorCycleBuilder motorCycleBuilder = new MotorCycleBuilder(); CarBuilder carBuilder = new CarBuilder(); ScooterBuilder scooterBuilder = new ScooterBuilder(); // create a director object Shop shop = new Shop(); shop.Construct(motorCycleBuilder); motorCycleBuilder.Vehicle.Show(); shop.Construct(carBuilder); carBuilder.Vehicle.Show(); shop.Construct(scooterBuilder); scooterBuilder.Vehicle.Show(); Console.ReadKey(); }
static void Main(string[] args) { VehicleBuilder builder; Shop shop = new Shop(); builder = new ScooterBuilder(); shop.Construct(builder); builder.Vehicle.Show(); builder = new CarBuilder(); shop.Construct(builder); builder.Vehicle.Show(); builder = new MotorCycleBuilder(); shop.Construct(builder); builder.Vehicle.Show(); Showable adapter = new TransportAdapter(builder.Vehicle); //adapter.Show(); }
static void Main(string[] args) { #region 结构实现 // Create director and builders Director director = new Director(); Structural.Builder b1 = new ConcreteBuilder1(); Structural.Builder b2 = new ConcreteBuilder2(); // Construct two products director.Construct(b1); Product p1 = b1.GetResult(); p1.Show(); director.Construct(b2); Product p2 = b2.GetResult(); p2.Show(); #endregion Console.WriteLine("******************************"); #region 实践应用 VehicleBuilder builder; Shop shop = new Shop(); builder = new ScooterBuilder(); shop.Construct(builder); builder.Vehicle.Show(); builder = new CarBuilder(); shop.Construct(builder); builder.Vehicle.Show(); builder = new MotorCycleBuilder(); shop.Construct(builder); builder.Vehicle.Show(); #endregion Console.ReadKey(); }
static void Main(string[] args) { Shop shop = new Shop(); Builder Lanos = new DaewooLanosBuilder(); Builder Probe = new FordProbeBuilder(); Builder Patriot = new UAZPatriotBuilder(); shop.Construct(Lanos); Product lonasProduct = Lanos.GetResult(); lonasProduct.Show(); }
public static void Main() { AVehicleBuilder builder; Shop shop = new Shop(); builder = new ScooterBuilder(); shop.Construct(builder); Console.WriteLine("---------------------------"); Console.WriteLine(builder.Vehicle); builder = new CarBuilder(); shop.Construct(builder); Console.WriteLine("\r\n---------------------------"); Console.WriteLine(builder.Vehicle); builder = new MotorCycleBuilder(); shop.Construct(builder); Console.WriteLine("\r\n---------------------------"); Console.WriteLine(builder.Vehicle); Console.ReadKey(); }