본문 바로가기

C# 디자인패턴16

11# Decorator패턴 Structural Patterns static void Main(string[] args) { //BuilderExample(); //FactoryExample(); //FactoryMethodExample(); //FactoryMethodExample2(); //ProtoTypeExample(); //SingletonExample(); //AdapterExample(); //BridgeExample(); //CompositeExample(); DecoratorExample(); //Console.WriteLine("Hello World!"); Console.ReadKey(); } static void DecoratorExample() { Book book = new Book("Worley", "Inside asp.net", 10); b.. 2019. 6. 3.
10# Composite패턴 Structural Patterns static void Main(string[] args) { //BuilderExample(); //FactoryExample(); //FactoryMethodExample(); //FactoryMethodExample2(); //ProtoTypeExample(); //SingletonExample(); //AdapterExample(); //BridgeExample(); CompositeExample(); //Console.WriteLine("Hello World!"); Console.ReadKey(); } static void CompositeExample() { CompositeElement root = new CompositeElement("Picture"); root.Add(new Primiti.. 2019. 6. 3.
09# Bridge패턴 Structural Patterns static void Main(string[] args) { //BuilderExample(); //FactoryExample(); //FactoryMethodExample(); //FactoryMethodExample2(); //ProtoTypeExample(); //SingletonExample(); //AdapterExample(); BridgeExample(); //Console.WriteLine("Hello World!"); Console.ReadKey(); } static void BridgeExample() { Customers customers = new Customers("Chicago") { DataObject = new CustomersData() }; customers.ShowRec.. 2019. 5. 29.
08# Adapter 패턴 Structural Patterns static void Main(string[] args) { //BuilderExample(); //FactoryExample(); //FactoryMethodExample(); //FactoryMethodExample2(); //ProtoTypeExample(); //SingletonExample(); AdapterExample(); //Console.WriteLine("Hello World!"); Console.ReadKey(); } static void AdapterExample() { Compound unknown = new Compound(Compound.CompoundTypes.NONE); Compound water = new RichCompound(Compound.CompoundTypes.W.. 2019. 5. 29.