Esempio n. 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 () ;
        }
Esempio n. 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));
        }
Esempio n. 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();
        }
Esempio n. 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));
        }
Esempio n. 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());
        }
Esempio n. 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));
        }
Esempio n. 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();
        }
Esempio n. 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
        }
Esempio n. 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();
        }
Esempio n. 10
0
 public Adapter(Adaptee adaptee)
 {
     _adaptee = adaptee;
 }
Esempio n. 11
0
 public Adapter(Adaptee adaptee)
 {
     this.adaptee = adaptee;
 }
Esempio n. 12
0
 public ConcreteAdapter(Adaptee adaptee)
 {
     _adaptee = adaptee;
 }
Esempio n. 13
0
 public ObjectAdapter(Adaptee adaptee)
 {
     this._adaptee = adaptee;
 }
Esempio n. 14
0
 public Adapter(Adaptee adaptee)
 {
     this.adaptee = adaptee;
 }
Esempio n. 15
0
 public Adapter(Adaptee aee)
 {
     adaptee = aee;
 }
Esempio n. 16
0
 public Adapter(Adaptee adaptee)
 {
     _adaptee = adaptee;
 }