C#获取类里面的所有的方法名称

Type trypInfo = typeof(Program);// Program为类名
//获得方法名
string str = "包括的方法名列表:\r\n";
 MethodInfo[] methodInfo = trypInfo.GetMethods();
 foreach (MethodInfo mInfo in methodInfo)
 {
       str += mInfo.ToString() + "\r\n";
}

 

注:需要引用

using System.Reflection;
posted @ 2013-07-17 19:36  pnljs  阅读(1158)  评论(0编辑  收藏  举报