共 5 篇文章 |
|
c#动态编译,程序集的动态创建。// 设置编译参数CompilerParameters options = new CompilerParameters();options.ReferencedAssemblies.Add("System.dll");options.GenerateExecutable = true;options.OutputAssembly = "HelloWorld.exe";// 显示编译信息if (cr.Errors.Count == 0)Console.WriteLine("/"{0}/&q... 阅1926 转7 评0 公众公开 14-10-14 11:08 |
public static Type CompileClass(string code, params Type[] usingTypes){ var ass = CompileAssembly(code, usingTypes);}public static object CompileObject(string code, params Type[] usingTypes){ var ass = CompileAssembly(code, usingTypes);public decimal GetValue(string formula){ string code = @"public class Class1{ ... 阅62 转3 评0 公众公开 14-10-10 10:54 |
Append(Json.public class Program : IGetString{ public static string A(object obj) { return obj.333ms | 25ms330ms | 24ms326ms | 24ms320ms | 24ms320ms | 23ms328ms | 24ms326ms | 25ms327ms | 24ms330ms | 25ms328ms | 24ms请按任意键继续. ..不过对Json有兴趣的也可以mark下,动态编译的连载结束后就会完成Json的优化,按照现在已完成... 阅48 转2 评0 公众公开 14-10-10 10:53 |
阅68 转1 评0 公众公开 14-10-10 10:52 |
WriteLine("错误"); } } public static decimal Calculate(string formula) { string code = @" public class Class1 { public static decimal GetValue() { return (decimal)(" + formula + @"); } } "; //第二个参数就是这个类中所有用到的类型,包括隐式类型 Type type = DynamicCompile_1.CompileAssembly(co... 阅158 转3 评0 公众公开 14-10-10 10:50 |