#region 获取所有方法 /// <summary> /// 获取所有方法 /// </summary> /// <returns></returns> public ActionResult GetMethod() { Dictionary<string, string> dics = new Dictionary<string, string>(); Type type = typeof(KedaoJingLingController); foreach (MethodInfo methodInfo in type.GetMethods()) { if (methodInfo.IsSecurityCritical) { var paras = string.Empty; foreach (var para in methodInfo.GetParameters()) { paras += para.Name + "=" + para.ParameterType.Name + "&"; } paras = paras.TrimEnd('&'); var mothodName = methodInfo.Name; var description = methodInfo.GetCustomAttributes(typeof(DescriptionAttribute), true); if (description.Length > 0) { mothodName = string.Format("{0} {1}", mothodName, (description[0] as DescriptionAttribute).Description); } dics.Add(mothodName, paras); } } return Json(dics); } #endregion