1)调用JS计算方法
MSScriptControl.ScriptControl scriptControl =newMSScriptControl.ScriptControl();
scriptControl.Language="JScript";stringvalue = scriptControl.Eval("1+2*(4-3)").ToString();
Console.WriteLine(value);
2)使用DataTable的Compute()方法
DataTable table =newDataTable();stringvalue = table.Compute("1+2*(4-3)","").ToString();
Console.WriteLine(value);
网友评论