/// <summary>
 /// 获取字段说明符上的显示名称
 /// </summary>
 /// <param name="member"></param>
 /// <returns></returns>
 public static string GetDisplayName(this FieldInfo field)
 {
     if (Attribute.IsDefined(field, typeof(ResourceDisplayNameAttribute)))
     {
         ResourceDisplayNameAttribute att = Attribute.GetCustomAttribute(field, typeof(ResourceDisplayNameAttribute)) as ResourceDisplayNameAttribute;
         return(att.ResourceDisplayName);
     }
     if (Attribute.IsDefined(field, typeof(DisplayNameAttribute)))
     {
         DisplayNameAttribute att = Attribute.GetCustomAttribute(field, typeof(DisplayNameAttribute)) as DisplayNameAttribute;
         return(att.DisplayName);
     }
     return(null);
 }
        /// <summary>
        /// 获取属性说明符上的显示名称
        /// </summary>
        /// <param name="member"></param>
        /// <returns></returns>
        public static string GetDisplayName(this Type type)
        {
            if (Attribute.IsDefined(type, typeof(ResourceDisplayNameAttribute)))
            {
                ResourceDisplayNameAttribute att = Attribute.GetCustomAttribute(type, typeof(ResourceDisplayNameAttribute)) as ResourceDisplayNameAttribute;
                return(att.ResourceDisplayName);
            }

            if (Attribute.IsDefined(type, typeof(System.ComponentModel.DisplayNameAttribute)))
            {
                System.ComponentModel.DisplayNameAttribute att = Attribute.GetCustomAttribute(type, typeof(System.ComponentModel.DisplayNameAttribute)) as System.ComponentModel.DisplayNameAttribute;
                return(att.DisplayName);
            }
            return(null);
        }
        /// <summary>
        /// 获取属性说明符上的显示名称
        /// </summary>
        /// <param name="member"></param>
        /// <returns></returns>
        public static string GetDisplayName(this PropertyDescriptor member)
        {
            ResourceDisplayNameAttribute attr = member.Attributes[typeof(ResourceDisplayNameAttribute)] as ResourceDisplayNameAttribute;

            if (attr != null)
            {
                return(attr.ResourceDisplayName);
            }
            DisplayNameAttribute attr2 = member.Attributes[typeof(DisplayNameAttribute)] as DisplayNameAttribute;

            if (attr2 != null)
            {
                return(attr2.DisplayName);
            }
            return(null);
        }