现在的位置: 首页 > 综合 > 正文

No 57 · typeof 表达式的使用

2014年02月06日 ⁄ 综合 ⁄ 共 208字 ⁄ 字号 评论关闭
Type trypInfo = typeof(Program);// Program为类名
            //获得方法名
            string str = "包括的方法名列表:\r\n";
            MethodInfo[] methodInfo = trypInfo.GetMethods();
            foreach (MethodInfo mInfo in methodInfo)
            {
                str += mInfo.ToString() + "\r\n";
            }
            MessageBox.Show(str);

 

抱歉!评论已关闭.