static void Main(string[] args) { const ClotheProviders provider = ClotheProviders.Trousers; var clothes = ClothProviderFactory.GetClothesPrinter(provider); clothes.PrintClothes(); clothes = ClothProviderFactory.GetClothesPrinter(ClotheProviders.Shirt); clothes.PrintClothes(); Console.ReadKey(); }
public static IClothes GetClothesPrinter(ClotheProviders providers) { switch (providers) { case ClotheProviders.Shirt: return(new Shirt()); case ClotheProviders.Trousers: return(new Trousers()); default: return(null); } }