コード例 #1
0
ファイル: RealWorld.cs プロジェクト: sdilsiz/DesignPatterns
            /// <summary>
            /// Entry point into console application.
            /// </summary>
            public static void Main()
            {
                // Non-adapted chemical compound

                Compound unknown = new Compound("Unknown");

                unknown.Display();

                // Adapted chemical compounds

                Compound water = new RichCompound("Water");

                water.Display();

                Compound benzene = new RichCompound("Benzene");

                benzene.Display();

                Compound ethanol = new RichCompound("Ethanol");

                ethanol.Display();

                // Wait for user

                Console.ReadKey();
            }
コード例 #2
0
        static void Main(string[] args)
        {
            // Example 1

            example_1.ITarget adapter = new VendorAdapter();

            foreach (string product in adapter.GetProducts())
            {
                Console.WriteLine(product);
            }


            // Example 2

            example_2.ITarget adapter2 = new EmployeeAdapter();

            ThirdPartyBillingSystem client = new ThirdPartyBillingSystem(adapter2);

            client.ShowEmployeeList();

            // Example 3

            // Non-adapted chemical compound
            Compound unknown = new Compound("Unknown");

            unknown.Display();

            // Adapted chemical compounds
            Compound water = new RichCompound("Water");

            water.Display();

            Compound benzene = new RichCompound("Benzene");

            benzene.Display();

            Compound ethanol = new RichCompound("Ethanol");

            ethanol.Display();

            // Example 4

            ILumiaXMLTarget lumiaXmladapter = new LumiaXMLAdapter();
            XmlDocument     lumiaXmlData    = lumiaXmladapter.GetLumiaMobilesXMLSpecifications();
        }
コード例 #3
0
        /// <summary>
        /// Entry point into console application.
        /// </summary>
        public void Execute()
        {
            // Non-adapted chemical compound
            Compound unknown = new Compound("Unknown");

            unknown.Display();

            // Adapted chemical compounds
            Compound water = new RichCompound("Water");

            water.Display();

            Compound benzene = new RichCompound("Benzene");

            benzene.Display();

            Compound ethanol = new RichCompound("Ethanol");

            ethanol.Display();
        }
コード例 #4
0
        /// <summary>
        /// Entry point into console application.
        /// </summary>
        private static void Main()
        {
            // Non-adapted chemical compound
              Compound unknown = new Compound("Unknown");
              unknown.Display();

              // Adapted chemical compounds
              Compound water = new RichCompound("Water");
              water.Display();

              Compound benzene = new RichCompound("Benzene");
              benzene.Display();

              Compound ethanol = new RichCompound("Ethanol");
              ethanol.Display();

              // Wait for user
              Console.ReadKey();
        }