Beispiel #1
0
 public void UsageMethod()
 {
     ICreator[] creators = new ICreator[2];
     creators[0] = new ConcreteCreator1();
     creators[1] = new ConcreteCreator2();
     foreach (ICreator creator in creators)
     {
         IProduct product = creator.FactoryMethod();
         System.Diagnostics.Debug.WriteLine("The type created was {0}", product.GetType().Name);
     }
 }
 public void UsageMethod()
 {
     ICreator[] creators = new ICreator[2];
     creators[0] = new ConcreteCreator1();
     creators[1] = new ConcreteCreator2();
     foreach (ICreator creator in creators)
     {
         IProduct product = creator.FactoryMethod();
         System.Diagnostics.Debug.WriteLine("The type created was {0}", product.GetType().Name);
     }
 }