1、MethodInfo類是在System.Reflection命名空間底下,既然是在Reflection空間底下。故名思議關於反射相關的操作,其中比較重要的方法是Invoke()方法,它
是加載相同程序集的方法。簡單用法
string command = "AnnouncementSave";
//通過反射獲取調用的具體方法
System.Reflection.MethodInfo method = this.GetType().GetMethod(command);
if (method != null)
{
//Execute Method
method.Invoke(this, new object[] { context });
}
調用方法:
public void AnnouncementSave(HttpContext context)
{
}