方法一:
引用using Microsoft.JScript.dll
然后使用Eval.JScriptEvaluate方法
具体如下:
string result = string.Format("({0}-{1})/100",500,100);
Console.WriteLine(Microsoft.JScript.Eval.JScriptEvaluate(result, Microsoft.JScript.Vsa.VsaEngine.CreateEngine()).ToString());
方法二:
str_value = new DataTable().Compute(string.Format(tbCount_Rules.Text.Trim(), ListToObject(percount)), "").ToString();
来自:
http://www.cnblogs.com/flish/archive/2011/06/29/2093662.html