I am trying to parse formula in C# language like
"5*3 + 2"
"(3*4 - 2)/5"
Is it possible to do in C# or scripts like VBScript, JavaScript (which will be called in c# program).
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There’s a trick I’ve used before to do this sort of thing in C#, which is to use JScript.NET’s
evalfunction. You’ll find the complete code in my answer to this question. It’s not relying on a scripting language like VBScript or JavaScript, it’s pure .NET, and the implementation I use generates a JScript.NET assembly on the fly from C# code, so there’s no need to mix languages in your solution.