/// <summary> /// Enum added must have attribute for Display Text Key /// </summary> /// <typeparam name="TEnum"></typeparam> /// <param name="enumValue"></param> /// <returns></returns> public static string GetCaptionFromEnum <TEnum>(TEnum value) where TEnum : new() { DisplayTextKeyAttribute displayTextKeyAttribute = EnumAttributeUtility <TEnum, DisplayTextKeyAttribute> .GetEnumAttribute(value.ToString()); return(ResourceUtility.GetCaptionFor(displayTextKeyAttribute.Key)); }
/// <summary> /// Determines whether the specified attr is valid. /// </summary> /// <param name="attribute">The attr.</param> /// <returns> /// <c>true</c> if the specified attr is valid; otherwise, <c>false</c>. /// </returns> public static bool IsValid(DisplayTextKeyAttribute attribute) { return(attribute != null && !ValidatorUtility.IsNullOrEmpty(attribute.Key)); }