示例#1
0
        static void Main(string[] args)
        {
            var constExpression1     = new ConstExpression(3);
            var constExpression2     = new ConstExpression(4);
            var parametarExpressionX = new ParametarExpression("x");
            var parametarExpressionY = new ParametarExpression("y");
            var parametarExpressionA = new ParametarExpression("a");
            var parametarExpressionB = new ParametarExpression("b");
            var binaryExpressionAdd  = new BinaryExpression(parametarExpressionX, parametarExpressionY, "+", true);
            var binaryExpressionMul  = new BinaryExpression(constExpression2, binaryExpressionAdd, "*", false);

            var binaryExpressionMul2 = new BinaryExpression(parametarExpressionA, parametarExpressionB, "*", false);
            var binaryExpressionAdd2 = new BinaryExpression(binaryExpressionMul2, binaryExpressionMul, "+", true);

            var binaryExpressionMul3 = new BinaryExpression(constExpression1, binaryExpressionAdd2, "*", false);

            Console.Write("Za izraz: ");
            binaryExpressionMul3.Printf();

            Parametar[]      array = new Parametar[4];
            List <Parametar> lst   = new List <Parametar>();

            for (int i = 0; i < 4; i++)
            {
                Console.WriteLine("Unesite parametar i njegovu vrednost:");
                lst.Add(new Parametar(Console.ReadLine(), double.Parse(Console.ReadLine())));
            }

            Console.Write("Resenje je: ");
            Console.WriteLine(binaryExpressionMul3.Compile()(lst));
        }
        static void Main(string[] args)
        {
            var a = new ConstExpression(3);
            var b = new ConstExpression(4);
            var c = new ParametrExpression("x");
            var d = new ParametrExpression("y");
            var e = new ParametrExpression("a");
            var f = new ParametrExpression("b");
            var g = new BinaryExpression(c, d, "+", true);
            var h = new BinaryExpression(b, g, "*", false);
            var j = new BinaryExpression(e, f, "*", false);
            var p = new BinaryExpression(j, h, "+", true);
            var q = new BinaryExpression(a, p, "*", false);

            Console.Write("Za izraz: ");
            q.Printf();

            //Parametar[] array = new Parametar[4];
            List <Parametar> lst = new List <Parametar>();

            for (int i = 0; i < 4; i++)
            {
                Console.WriteLine("Unesite parametar i njegovu vrednost:");
                lst.Add(new Parametar(Console.ReadLine(), double.Parse(Console.ReadLine())));
            }

            Console.Write("Resenje je: ");
            Console.WriteLine(q.Compile()(lst));

            //var help = new ExportClass();
            //var method12 = new BMICalculator();
            //help.ExportProperty = method12.BMI;
            //Console.WriteLine(help.ExportProperty);
            //var tmp = new ExportClass();
            //Type type = typeof(BMICalculator);
            //PropertyInfo[] properties = type.GetProperties();
            //foreach (PropertyInfo property in properties)
            //{
            //    Console.WriteLine(property.PropertyType);
            //}

            //List<Assembly> Assemblies = AppDomain.CurrentDomain.GetAssemblies().Where(x => x.FullName.Contains("Expression")).ToList();

            Assembly[]      assemblies   = AppDomain.CurrentDomain.GetAssemblies();
            List <Assembly> myAssemblies = new List <Assembly>();

            foreach (Assembly item in assemblies)
            {
                if (item.GetName().Name.Contains("Expression"))
                {
                    myAssemblies.Add(item);
                }
            }
        }