Beispiel #1
0
 /// <summary>
 ///     Gets the enumeration for the given string representation.
 /// </summary>
 /// <param name="enumValue">The EnumMemberAttribute value, enumeration string value, or integer value (as string) of the enumeration.</param>
 /// <exception cref="InvalidOperationException">The type parameter is not an Enumeration.</exception>
 /// <typeparam name="TEnum">The type must be an enumeration.</typeparam>
 public static TEnum GetEnum <TEnum>(this string enumValue) where TEnum : struct
 {
     return(PrettyEnumHelpers <TEnum> .GetEnumFrom(enumValue));
 }
Beispiel #2
0
 /// <summary>
 ///     Gets the optimal string representation of an enumeration.
 /// </summary>
 /// <returns>Returns EnumMember Value if present, otherwise returns enumValue.ToString().</returns>
 /// <exception cref="InvalidOperationException">The type parameter is not an Enumeration.</exception>
 /// <typeparam name="TEnum">The type must be an enumeration.</typeparam>
 public static string GetOptimalEnumDescription <TEnum>(this TEnum enumValue) where TEnum : struct
 {
     return(PrettyEnumHelpers <TEnum> .GetOptimalEnumDescription(enumValue));
 }