static void Main(string[] args) { // Example var vectorObjects = new List <VectorObject> { new VectorRectangle(1, 1, 2, 2), new VectorRectangle(3, 3, 6, 6) }; foreach (var vo in vectorObjects) { foreach (var line in vo) { var adapter = new LineToPointAdapter(line); adapter.ForEach(Draw.Point); } } Console.WriteLine(); Console.WriteLine(); // SimpleSample var classManager = new ClassManager(); IClassManager IClassManager = new ClassAdapter(classManager); Console.WriteLine("Original Xml Output\n" + classManager.GetAllStudents()); Console.WriteLine("Adapter Json Output\n" + IClassManager.GetAllStudents()); }
static void Main(string[] args) { Console.WriteLine("Hello World!"); ITarget classAdapter = new ClassAdapter(); classAdapter.Charging(); Console.ReadLine(); }
static void Main(string[] args) { ITarget target = new ClassAdapter(); target.DoSomeThingClientNeed(); ObjectAdapter adapter = new ObjectAdapter(); adapter.DoSomeThingClientNeed(); Console.ReadLine(); }
static void Main(string[] args) { Adaptee adaptee = new Adaptee(); ITarget target = new ObjectAdapter(adaptee); Console.WriteLine("Adaptee interface is incompatible with the client."); Console.WriteLine("But with adapter client can call it's method."); Console.WriteLine(target.GetRequest()); ITarget target2 = new ClassAdapter(); Console.WriteLine(target2.GetRequest()); }
static void Main(string[] args) { var adaptee = new Adaptee(); //Delegation을 이용한 Adapter var adapter = new Adapter(adaptee); adapter.Request(); //Inheritance를 이용한 Adapter //SpecificRequest()를 호출하지 않도록 주의합니다. var classAdapter = new ClassAdapter(); classAdapter.Request(); }