获取一个类的方法列表C#

80酷酷网    80kuku.com

   private string[] getMethodList(System.Type myType)
  {
   int i,l;
   MethodInfo myMethodInfo;
   MethodInfo[] myArrayMethodInfo = myType.GetMethods(BindingFlags.Public|BindingFlags.Instance|BindingFlags.DeclaredOnly);
   l = myArrayMethodInfo.Length;
   string[] methodList=new string[l];
   for(i=0;i<myArrayMethodInfo.Length;i++)
   {
    myMethodInfo = (MethodInfo)myArrayMethodInfo[i];
    methodList[i] = myMethodInfo.Name ;
   }
   return methodList;
  }












分享到
  • 微信分享
  • 新浪微博
  • QQ好友
  • QQ空间
点击: