MethodInfo类的一般使用

 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)
      {

      }

原文地址:https://www.cnblogs.com/tsql/p/7986534.html