public static void Main (string[] args) { Target t = new Adapter (); //instiante Target interface with Adapter Client c = new Client (t); //put the instance of Target interface into client c.MakeRequest (); //now client can use method B from Adaptee through Adapter Adapter a = new Adapter (); // we can also directly put the instance of Adapter into client Client cc = new Client (a); cc.MakeRequest (); }
public static void Main() { var list=new List<int>(); list.Add(1); list.Add(2); list.Add(3); Client client =new Client(new Addopter()); var oddNumbers = client.ReturnOddNumbers(list); Console.WriteLine(oddNumbers); }