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

      }

posted on 2017-12-05 13:46  无爱无伤  阅读(315)  评论(0编辑  收藏  举报