public static string ToShortNameString(this ICustomAttributeProvider cat) { var atrDisp = ReflexionUtils.GetAtribute <DisplayAttribute>(cat); if (atrDisp != null) { return(atrDisp.GetShortName()); } if (cat is PropertyInfo) { return((cat as PropertyInfo).Name); } if (cat is MemberInfo) { return((cat as MemberInfo).Name); } if (cat is FieldInfo) { return((cat as FieldInfo).Name); } if (cat is Type) { return((cat as Type).Name); } return(cat.ToString()); }
public static string ToShortNameString(this Enum cat) { var atrDisp = ReflexionUtils.GetAtribute <DisplayAttribute>(cat); if (atrDisp != null) { return(atrDisp.GetShortName()); } return(cat.ToString()); }
public static string ToDescriptionString(this Enum cat) { var atrDisp = ReflexionUtils.GetAtribute <DisplayAttribute>(cat); if (atrDisp != null) { return(atrDisp.GetDescription()); } var atrDesc = GetAtribute <DescriptionAttribute>(cat); if (atrDesc != null) { return(atrDesc.Description); } return("-"); }
public static string ToDisplayString(this Enum cat) { var atrDisp = ReflexionUtils.GetAtribute <DisplayAttribute>(cat); if (atrDisp != null) { return(atrDisp.GetName()); } var atrDispName = GetAtribute <DisplayNameAttribute>(cat); if (atrDispName != null) { return(atrDispName.DisplayName); } return(cat.ToString()); }