Implementing JS Eval in C#
Possible Duplicate: C# eval equivalent? Duplicate of How can I evaluate C# code dynamically? How can we Implement JS eval() in C# If possible provide an example.. thank you You can actually use the JScript eval function from C#... Create a file JsMath.js, with the following JScript code : class JsMath { static function Eval(expression : String) : double { return eval(expression); }; } Compile it into a DLL : jsc /t:library JsMath.js Add a reference to JsMath.dll to your project. You can now use the JsMath class in your code : double result = JsMath.Eval(expression); If you can use C# 3.0 /