原理﹕
使用js.net(因为里面有eval方法)编写一个类﹐类别中新增一个方法来执行动态js代码。
然后使用jsc.exe把它编译成一个dll
在c#项目中把它加入﹐然后传入动态代码﹐呼叫这个类别的这个方法﹐得到结果。
1.第一步﹐新增一个js文件
MyEval.js
class MyEval{
function execute(code:String) :String { // Method.
return eval(code);
}
}
2.编译成dll
jsc /target:library /out:MyEval.dll MyEval.js
3.编写测试文件
TestEval.cs
using System;

原文:http://www.cnblogs.com/Crackers/p/4282127.html