예제 #1
0
        static void Main(string[] args)
        {
            string   description = Console.ReadLine().ToLower();
            IMachine machine     = new MachineFactory().CreateInstance(description);

            machine.Identify();
            machine.Operate();

            Console.ReadKey();
        }
예제 #2
0
        static void Main(string[] args)
        {
            string description = args[0];

            IMachine machine = new MachineFactory().CreateInstance(description);

            machine.TurnOn();
            machine.TurnOff();

            Console.ReadKey();
        }
예제 #3
0
        static void Main(string[] args)
        {
            /* Assembly assemblyx = Assembly.Load("FactorypatternLib");
             * foreach (var assemblyName in Assembly.GetExecutingAssembly()
             *   .GetReferencedAssemblies())
             * {
             *   Assembly assembly = Assembly.Load(assemblyName);
             *   foreach (var type in assembly.GetTypes())
             *   {
             *       Console.WriteLine(type.Name);
             *   }
             * }*/

            //Assembly.GetAssembly()
            MachineFactory mf = new MachineFactory();
            var            r  = mf.CreateInstance("rob");

            r.TurnOn();

            //Type[] types = Assembly.GetAssembly( typeof(FactorypatternLib.)).GetTypes();
            Console.WriteLine();
        }