Inheritance: IEnemy
Exemple #1
0
 static void Main(string[] args)
 {
     Target target = new Adapter();
     target.Request();
     
     Console.ReadKey();
 }
Exemple #2
0
 static void Main(string[] args)
 {
     IVoltage adapter = new Adapter();
     string _voltage = adapter.GetCnVoltage();
     Console.WriteLine("美國佬電壓系{0}", _voltage);
     Console.Read();
 }
        /// <summary>
        /// Entry point into console application.
        /// </summary>
        static void Main()
        {
            // Create adapter and place a request
            Target target = new Adapter();
            target.Request();

            // Wait for user
            Console.ReadKey();
        }
        public void Test()
        {
            var     adaptee = new Adaptee();
            ITarget target  = new Adapter.Adapter(adaptee);

            _testOutputHelper.WriteLine("Adaptee interface is incompatible with the client.");
            _testOutputHelper.WriteLine("But with adapter client can call it's method.");

            _testOutputHelper.WriteLine(target.GetRequest());
        }
        static void Main(string[] args)
        {
            ILog ILog = new Log();//Log Antigo
            ILog.RegistraLog("Teste de Log Antigo", TipoLog.Erro);

            ILog = new Adapter();
            ILog.RegistraLog("Teste de Log4Net", TipoLog.Erro);

            Console.ReadKey();
        }
Exemple #6
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 () ;
        }
Exemple #7
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));
        }
        static void Main(string[] args)
        {
            Console.WriteLine("适配器模式:将于个接口转换成客户希望的另一个接口,使接口不兼容的那些类可以一起工作,其别名为包装器。适配器模式既可以作为类结构模式,也可以作为对象结构模式。");

            int[] score = { 85, 66, 99, 445, 45, 18, 48749, 4645, 1, 1456, 4, 164, 747 };
            ITarget tar=new Adapter();
            tar.sort(score);
            foreach (var item in score)
            {
                Console.WriteLine(item.ToString());
            }
            Console.ReadKey();
        }
Exemple #9
0
        static void Main(string[] args)
        {
            #region 基本用法(Basic.cs)
            Target target = new Adapter();
            target.Request();
            #endregion

            #region 具体实例(Example.cs)
            Player b = new Forwards("巴蒂尔");
            b.Attack();

            Player m = new Guards("麦克格雷迪");
            m.Attack();

            //Player ym = new Center("姚明");
            Player ym = new Translator("姚明");
            ym.Attack();
            ym.Defense();

            Console.Read();
            #endregion
        }
Exemple #10
0
        /*
         * Resumo:(como se fosse um adaptador mesmo) resolve o proble de trabalhar com classe e interfaces incopativeis(que não se relacionam)
         *
         * A intenção do padrão Adapter, também conhecido como Wrapper, é converter a interface de uma classe em outra interface esperada pelos clientes. Permite que classes trabalhem em conjunto,
         * pois de outra forma não poderiam devido a suas interfaces incompatíveis.
         *
         * Participantes:
         * Target - define uma interface específica do domínio que o Cliente usa;
         * Client - colabora com objetos compatíveis com a interface de Target;
         * Adaptee - define uma interface existente que necessita ser adaptada.
         * Adapter - adpata a interface do Adaptee à inteface do Target;
         *
         *
         */

        public void Adapter()
        {
            Target target = new Adapter.Adapter();

            Response.Write(target.Request());
        }
Exemple #11
0
 static void Main(string[] args)
 {
     Target adapter = new Adapter();
     adapter.Request();
     Console.ReadKey();
 }
Exemple #12
0
 static void Main(string[] args)
 {
     Target t = new Adapter(new Adaptee());
     Console.WriteLine("Info: {0}", t.Info());
 }
Exemple #13
0
		static void Main(string[] args) {
			ITarget target = new Adapter(new Adaptee());
			target.Request();

			Console.ReadLine();
		}
Exemple #14
0
        public static void Main(string[] args)
        {
            Client client = new Adapter();

            client.RunAdapteeMethod();
        }
Exemple #15
0
 static void Main(string[] args)
 {
     ExpectedInterface adapter = new Adapter();
     Operation(adapter);
 }