コード例 #1
0
        public void Complex()
        {
            var compiler = new FormulaCompiler()
                           .WithMath().WithInfo(FormulaCompilerBuildInfoLevels.None);

            TestTime.Measure(1000, () => compiler.Compile <int>("2+2*2 + max(4,5)"));
        }
コード例 #2
0
        public void ProcessorCount()
        {
            var compiler = new FormulaCompiler()
                           .WithInfo(FormulaCompilerBuildInfoLevels.None)
                           .WithSystem();

            TestTime.Measure(1000, () => compiler.Compile <int>("Environment.ProcessorCount"));
        }
コード例 #3
0
        public void Simple()
        {
            var compiler = new FormulaCompiler()
                           .WithInfo(FormulaCompilerBuildInfoLevels.None);

            compiler.Compile <int>("5+4");

            TestTime.Measure(1000, () => compiler.Compile <int>("5+4"));
        }
コード例 #4
0
        public void Linq()
        {
            var compiler = new FormulaCompiler()
                           .WithInfo(FormulaCompilerBuildInfoLevels.None)
                           .WithLinq();
            var lambda = compiler.NewLambda()
                         .WithParam <IEnumerable <int> >("input")
                         .Returns <int>();

            TestTime.Measure(1000, () => lambda.Compile("input.Max()"));
        }