做网站后台管理系统的时候,有时我们需要根据用户的录入配置动态生成一些频道,这些频道需要用到独立的Controller,这时就需要用到运行时动态编译了.代码如下: using System.Web.Mvc; using System.CodeDom.Compiler; using System.Text; using Microsoft.CSharp; namespace DynamicCompiler.Controllers { public class HomeController : Con
1.新建測试dll及方法,用vs2010新建winform程序,详细代码例如以下: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace reflect { publ
C# 动态装载 DLL LoadDllTool.cs 如下: using System; using System.Collections.Generic; using System.Text; using System.Runtime.InteropServices; // 用 DllImport 需用此 命名空间 using System.Reflection; // 使用 Assembly 类需用此 命名空间 using System.Reflection.Emit; // 使用 ILGe