当前位置:编程学习 > C#/ASP.NET >>

写在TEXTBOX里的代码如何放到程序代码中

我想把代码写在textbox中,然后运行的时候会执行textbox里的代码,请问如何实现? --------------------编程问答-------------------- 动态编译 --------------------编程问答-------------------- http://blog.csdn.net/xufei96/archive/2010/01/07/5152787.aspx --------------------编程问答-------------------- CSharpCodeProvider p = new CSharpCodeProvider();
  CompilerParameters param = new CompilerParameters(new string[] { "System.dll" });
  string s = "namespace __ns{public class AAA{ public string name{get{return '";}} }}";
  CompilerResults rel = p.CompileAssemblyFromSource(param, s);
  Type t = rel.CompiledAssembly.GetType("");
  object o = t.GetConstructor(System.Type.EmptyTypes).Invoke(null);
  MessageBox.Show(t.GetProperty("name").GetValue(o, null).ToString());
--------------------编程问答-------------------- 需求好抽象。。。
--------------------编程问答-------------------- 动态编译应该可以 --------------------编程问答-------------------- server.execute(textbox1.Text); --------------------编程问答-------------------- 动态编译. --------------------编程问答-------------------- 把它作为字符串,在后台来拼接注册脚本,并执行 --------------------编程问答-------------------- --------------------编程问答-------------------- --------------------编程问答-------------------- 好牛 动态编译。 那自己能写编译器了?
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,