标签:style blog http io os 使用 ar for 2014
1. 安装nuget package
2.使用Roslyn 动态执行
var engine = newRoslyn.Scripting.CSharp.ScriptEngine(); engine.CreateSession().Execute ("System.Console.WriteLine(\"Hello , Roslyn .\");");
3.使用Roslyn 动态编译
var engine = newRoslyn.Scripting.CSharp.ScriptEngine(); var list = new List<string> {"abc", "bcd","acd"}; var excutable = engine.CreateSession(). CompileSubmission<Func<string,bool>> ("(m) =>{returnm.StartsWith(\"a\");}").Execute(); var startWitha = list. Where(excutable); foreach (var str in startWitha) { Console.WriteLine(str); }
标签:style blog http io os 使用 ar for 2014
原文地址:http://blog.csdn.net/lan_liang/article/details/39400117