在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
Type t = typeof(CommonController); StringBuilder str = new StringBuilder(); MethodInfo[] methors = t.GetMethods(BindingFlags.Instance | BindingFlags.Public); var md = t.GetCustomAttribute<System.ComponentModel.DescriptionAttribute>(); str.AppendFormat("路由:" + t.Name).AppendLine(""); str.AppendFormat("描述" + md.Description).AppendLine(""); foreach (var v in methors) { var af = v.GetCustomAttribute<Models.Attribute.APIFunctionAttribute>(); if (af != null) { str.AppendFormat("\t功能标识:{0}", v.Name).AppendLine(""); str.AppendFormat("\t功能描述:{0}", af.Description).AppendLine(""); ParameterInfo[] ps = v.GetParameters(); str.AppendFormat("\t参数:总数{0}", ps.Length).AppendLine(""); foreach (ParameterInfo p in ps) { str.AppendFormat("\t\t名称{0}", p.Name).AppendLine(""); str.AppendFormat("\t\t类型{0}", p.ParameterType.FullName).AppendLine(""); } }
|
请发表评论