예제 #1
0
파일: Program.cs 프로젝트: 2of3/SW-in-Games
        static void Main(string[] args)
        {
            Calculator calc = new Calculator();

            calc.operations = new List<IOperation>(new IOperation[] { new OpPlus(), new OpMinus(), new OpMult(), new OpDiv()});

            String s;
            Console.WriteLine("Enter Command:");
            while (true)
            {
                s = Console.ReadLine();
                Console.WriteLine(calc.Calculate(s));
            }
        }
예제 #2
0
파일: Program.cs 프로젝트: 2of3/SW-in-Games
        static void Main(string[] args)
        {
            var catalog = new AggregateCatalog();
            catalog.Catalogs.Add(new AssemblyCatalog(typeof(Program).Assembly));
            CompositionContainer container = new CompositionContainer(catalog);

            Calculator calc = new Calculator();

            container.ComposeParts(calc);
            // calc.operations = new List<IOperation>(new IOperation[] { new OpPlus(), new OpMinus(), new OpMult(), new OpDiv()});

            String s;
            Console.WriteLine("Enter Command:");
            while (true)
            {
                s = Console.ReadLine();
                Console.WriteLine(calc.Calculate(s));
            }
        }