PropertyInfo[] properties = typeof(BPM_ContractApproval_Purchase).GetProperties(); foreach (var property in properties) { string text = Convert.ToString(property.GetValue(entity)); var dingtalkAttribute = property.GetCustomAttribute(typeof(DingTalkFormInfoAttribute)) as DingTalkFormInfoAttribute; if (dingtalkAttribute != null) { var attribute = property.GetCustomAttribute(typeof(DisplayAttribute)) as DisplayAttribute; customeAttribute.Add(new BPM_Attribute_Dto() { Label = attribute != null ? attribute.Name : "", Text = text, OrderIndex = dingtalkAttribute.Index }); } }