コード例 #1
0
        static void Main()
        {
            ITarget iTarget = new EmployeeAdapter();
            ThirdPartyBillingSystem client = new ThirdPartyBillingSystem(iTarget);

            client.ShowEmployeeList();
        }
コード例 #2
0
        static void Main(string[] args)
        {
            ITarget Itarget = new EmployeeAdapter();
            ThirdPartyBillingSystem client = new ThirdPartyBillingSystem(Itarget);

            client.ShowEmployeeList();
            Console.ReadKey();
        }
コード例 #3
0
        public void Adapter_WithoutDesign()
        {
            //Our model with incompatible 
            var companyEmplyees = new CompanyEmplyees();

            //Convert it to List<String> ...
            List<string> employeeList = new List<string>();
            foreach (string[] employee in companyEmplyees.GetEmployees())
            {
                employeeList.Add(employee[0]);
                employeeList.Add(",");
                employeeList.Add(employee[1]);
                employeeList.Add(",");
                employeeList.Add(employee[2]);
                employeeList.Add("\n");
            }

            //We use a poor design to pass the data to third party
            ITarget Itarget = new CompanyEmplyeesStub(employeeList);

            ThirdPartyBillingSystem client = new ThirdPartyBillingSystem(Itarget);
            client.ShowEmployeeList();
        }
コード例 #4
0
 public void Adapter_With_Design()
 {
     ITarget Itarget = new EmployeeAdapter();
     ThirdPartyBillingSystem client = new ThirdPartyBillingSystem(Itarget);
     client.ShowEmployeeList();
 }
コード例 #5
0
ファイル: Program.cs プロジェクト: abramyk-mv/Adapter
        static void Main(string[] args)
        {
            ITarget Itarget = new EmployeeAdapter();
            ThirdPartyBillingSystem client = new ThirdPartyBillingSystem(Itarget);
            client.ShowEmployeeList();

            Console.ReadKey();
        }