An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
Microsoft.CodeAnalysis.CSharp.Scripting - C#
Hemanth B
886
Reputation points
Hi, I am using the nuget package Microsoft.CodeAnalysis.CSharp.Scripting for my expression evaluator in C#. Almost everything is getting evaluated except few, like "(1-32) * (5/9)" which is giving 0 as result and "(9/5)" which is giving 1 as result instead of 1.8. Why is this happening?
I am using this code:
var result = CSharpScript.EvaluateAsync<double>("(1- 32) (5/9)").Result;
Also when I provide the input without brackets in between or at the end like (1- 32) (5/9, it is throwing an exception saying ")" expected. How do I automatically add necessary brackets?
Developer technologies | C#
Developer technologies | C#
Sign in to answer