static void Main() { var first = new Adaptee (); Console.Write ("Before the new standard: "); first.ExecuteClassSpecificAction (); ITarget second = new Adapter (); Console.WriteLine ("\nMoving to the new standard"); second.ExecuteInterfaceSpecificAction () ; }
static void Main(string[] args) { // Showing the Adapteee in standalone mode Adaptee first = new Adaptee(); Console.Write("Before the new standard\nPrecise reading: "); Console.WriteLine(first.SpecificRequest(5, 3)); // What the client really wants ITarget second = new Adapter(); Console.WriteLine("\nMoving to the new standard"); Console.WriteLine(second.Request(5)); }
static void Main(string[] args) { var first = new Adaptee(); Console.Write("Before the new standard\nPrecise reading: "); Console.WriteLine(first.SpecificRequest(5, 3)); ITarget second = new Adapter(); Console.WriteLine("\nMoving to the new standard"); Console.WriteLine(second.Request(5)); Console.ReadLine(); }
public string GetAllProductNames() { Adaptee adaptee = new Adaptee(); string FormattedString = "<ul>{0}</ul>"; string placeholder = string.Empty; var productList = adaptee.GetAllProducts(); foreach (var product in productList) { placeholder += "<li>" + product.Name + "</li>"; } return(String.Format(FormattedString, placeholder)); }
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()); }
private static void Main() { //adaptee in standalone mode var adaptee = new Adaptee(); Console.WriteLine("Before the new standard\nPrecise reading: "); Console.WriteLine(adaptee.SpecificRequest(5, 3)); //What the client really wants ITarget adapter = new Adapter(); Console.WriteLine("\nMoving to the new standard"); Console.WriteLine(adapter.Request(5)); }
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(); }
static void Main(string[] args) { Target t1 = new Target(); t1.ExpectedMethod(); Adaptee adaptee = new Adaptee(); Target t2 = new Adapter(adaptee); t2.ExpectedMethod(); // Output: // Calls the ExpectedMethod // Calls the DifferentMethod }
static void Main(string[] args) { ITarget concreteTarget = new ConcreteTarget(); Adaptee adaptee = new Adaptee(); ITarget adapter = new Adapter(adaptee); concreteTarget.Action1(); concreteTarget.Action2(); concreteTarget.Action3(); Console.WriteLine(); adapter.Action1(); adapter.Action2(); adapter.Action3(); }
public Adapter(Adaptee adaptee) { _adaptee = adaptee; }
public Adapter(Adaptee adaptee) { this.adaptee = adaptee; }
public ConcreteAdapter(Adaptee adaptee) { _adaptee = adaptee; }
public ObjectAdapter(Adaptee adaptee) { this._adaptee = adaptee; }
public Adapter(Adaptee aee) { adaptee = aee; }