Esempio n. 1
0
        public void NewOperatorParsed()
        {
            var p = new MathParser();

            p.Operators.Add(new BinaryOperator<double>("$", 2, (x, y) =>
            {
                p.Manipulate("var x = " + x);
                p.Manipulate("var y = " + y);

                return p.Evaluate("x * y");
            }));

            Assert.AreEqual(p.Evaluate("3 $ 4"), 12);
        }