본문 바로가기

분류 전체보기301

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.
07# Singleton 패턴(thread safe) Creational Patterns static void Main(string[] args) { //BuilderExample(); //FactoryExample(); //FactoryMethodExample(); //FactoryMethodExample2(); //ProtoTypeExample(); SingletonExample(); //Console.WriteLine("Hello World!"); Console.ReadKey(); } static void SingletonExample() { LazySingleton.IsValueCreated(); Console.WriteLine("Name : {0} Age : {1}", LazySingleton.Instance.Name, LazySingleton.Instance.Age); LazySi.. 2019. 5. 24.
06# Prototype 패턴 Creational Patterns static void Main(string[] args) { //BuilderExample(); //FactoryExample(); //FactoryMethodExample(); //FactoryMethodExample2(); ProtoTypeExample(); //Console.WriteLine("Hello World!"); Console.ReadKey(); } static void ProtoTypeExample() { ColorManager colorManager = new ColorManager(); colorManager["red"] = new Color(255, 0, 0); colorManager["green"] = new Color(0, 255, 0); colorManager["blue"] =.. 2019. 5. 23.