/// <summary> /// 获取字段说明信息(跟进语言特征) /// </summary> protected static string GetDescription(FieldInfo field) { object[] attributes = field.GetCustomAttributes(false); string defaultAttribute = field.Name; if (attributes.Length > 0) { for (int i = 0; i < attributes.Length; i++) { if (attributes[i] is EnumAttribute) { EnumAttribute attr = attributes[i] as EnumAttribute; if (string.IsNullOrEmpty(attr.DescriptionEng)) { attr.DescriptionEng = defaultAttribute; } if (string.IsNullOrEmpty(attr.Description)) { attr.Description = defaultAttribute; } if (string.Compare("zh-CN", Thread.CurrentThread.CurrentUICulture.Name, true) == 0) { return(attr.Description); } if (string.Compare("en-US", Thread.CurrentThread.CurrentUICulture.Name, true) == 0) { return(attr.DescriptionEng); } } } } return(defaultAttribute); }