コード例 #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Adapter Pattern!");

            Adaptee adaptee = new Adaptee();
            ITarget target  = new Adapter(adaptee);

            Console.WriteLine(target.GetRequest());
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: oss6/design-patterns
        static void Main()
        {
            var api    = new ExternalApi();
            var target = new Adapter(api);

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

            Console.WriteLine(target.GetRequest());
        }
コード例 #3
0
        static void Main(string[] args)
        {
            Adaptee adaptee = new Adaptee();
            ITarget target  = new Adapter(adaptee);

            Console.WriteLine("Adaptee interface is incompatible with the client.");
            Console.WriteLine("But with adapater, client can call it's method!");

            Console.WriteLine(target.GetRequest());
            Console.ReadLine();
        }
コード例 #4
0
        static void Main(string[] args)
        {
            Adaptee adaptee = new Adaptee();
            ITarget target  = new Adapter(adaptee);

            Console.Write("This is the adapted class. ");
            Console.WriteLine(target.GetRequest());

            Console.WriteLine();

            Console.Write("Convert the type of GetSum from long to int: ");
            Console.WriteLine(target.GetSum(50, 50));
        }