Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NCalc: Are there alternatives?

Tags:

c#

ncalc

Does anyone know of a more up-to-date expression evaluator than NCalc? The last release was in 2011 and a (very) quick Google search returned pretty much nothing from what I could see.

like image 458
Skulmuk Avatar asked Jul 09 '13 16:07

Skulmuk


1 Answers

I know this is a late response but for the good of others searching and maybe yourself. Have you looked at Roslyn ? I believe that Microsoft are using it themselves now. You can pass simple c# or vb.net expressions for evaluation of complete code. Example below shows a simple math problem.

        ScriptEngine roslynEngine = new ScriptEngine();
        Roslyn.Scripting.Session session = roslynEngine.CreateSession();
        session.AddReference("System.Web");
        session.ImportNamespace("System");
        session.ImportNamespace("System.Web");
        var result = (session.Execute("1 + 1"));
like image 67
Steve Avatar answered Sep 30 '22 18:09

Steve