Exemplo n.º 1
0
 /// <summary>
 /// Converts the string to an enumeration value of type T, ignoring case.
 /// </summary>
 /// <typeparam name="T">Enum</typeparam>
 /// <param name="_string">String value to convert.</param>
 /// <param name="defaultValue">The default value if the conversion fails.</param>
 /// <returns>The numeration value represneted by the string, ignoring case.</returns>
 public static T ToEnum <T>(this string _string, T defaultValue) where T : struct, IConvertible
 {
     return(StringConverters._ToEnum <T>(_string, true, defaultValue));
 }
Exemplo n.º 2
0
 /// <summary>
 /// Converts the string to an enumeration value of type T, ignoring case.
 /// </summary>
 /// <typeparam name="T">Enum</typeparam>
 /// <param name="_string">String value to convert.</param>
 /// <returns>The numeration value represneted by the string, ignoring case.</returns>
 public static T ToEnum <T>(this string _string) where T : struct, IConvertible
 {
     return(StringConverters._ToEnum <T>(_string, false, default(T)));
 }