动态执行c#代码
- Roslyn
安装Microsoft.CodeAnalysis.CSharp.Scripting
using Microsoft.CodeAnalysis.CSharp.Scripting;
using Microsoft.CodeAnalysis.Scripting;
string code = "int result = 1 + 2; Console.WriteLine(result);";
var options = ScriptOptions.Default.WithImports("System");
var script = CSharpScript.Create(code, options);
script.RunAsync().Wait();
[参考]
https://blog.csdn.net/weixin_30802273/article/details/99274776
留待后查,同时方便他人
联系我:renhanlinbsl@163.com
联系我:renhanlinbsl@163.com