예제 #1
0
        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 () ;
        }
예제 #2
0
        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));
        }
예제 #3
0
        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();
        }
예제 #4
0
        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));
        }
예제 #5
0
        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());
        }
예제 #6
0
        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));
        }
예제 #7
0
        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();
        }
예제 #8
0
        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
        }
예제 #9
0
        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();
        }
예제 #10
0
 public Adapter(Adaptee adaptee)
 {
     _adaptee = adaptee;
 }
예제 #11
0
 public Adapter(Adaptee adaptee)
 {
     this.adaptee = adaptee;
 }
예제 #12
0
 public ConcreteAdapter(Adaptee adaptee)
 {
     _adaptee = adaptee;
 }
예제 #13
0
 public ObjectAdapter(Adaptee adaptee)
 {
     this._adaptee = adaptee;
 }
예제 #14
0
 public Adapter(Adaptee adaptee)
 {
     this.adaptee = adaptee;
 }
예제 #15
0
 public Adapter(Adaptee aee)
 {
     adaptee = aee;
 }
예제 #16
0
 public Adapter(Adaptee adaptee)
 {
     _adaptee = adaptee;
 }