/// <summary> /// 获取属性值并排序 /// </summary> /// <param name="cp"></param> /// <returns></returns> public static List<FieldAttributeInfo> GetComponentField(TypeAttribute component) { List<FieldAttributeInfo> list = new List<FieldAttributeInfo>(); IEnumerable<PropertyName> pNames = component.GetPropertyNames(); FieldAttributeInfo info = null; foreach (var n in pNames) { info = new FieldAttributeInfo(); PropertyInfo p = component.GetPropertyInfo(n.Name); info.Name = n.Name; var attrs = p.GetCustomAttributes(typeof(ComponentAttributeBase), false); bool hide = false; foreach (var a in attrs) { if (a is FieldDocumentAttribute) { FieldDocumentAttribute att = a as FieldDocumentAttribute; if (att.Order == 0) { info.Order = 100; } else { info.Order = att.Order; } info.Title = att.Title; info.Detail = att.Detail; info.Link = att.Link; hide = att.Hide; } } if (hide) { continue; } if (attrs.Length == 0) { info.Order = 100; } list.Add(info); } List<FieldAttributeInfo> listAsc = list.OrderBy(o => o.Order).ToList(); return listAsc; }