source/R5T.NetStandard.Types/Code/Helpers/EnumHelper.cs
/// <summary>
/// Parses the string representation of an enumeration value to an value of the <typeparamref name="TEnum"/> enumeration.
/// Note: this method restricts <typeparamref name="TEnum"/> as a struct, instead of an <see cref="Enum"/>, since <see cref="Enum.TryParse{TEnum}(string, out TEnum)"/> restricts on struct instead of <see cref="Enum"/>.
/// </summary>
Parses the string representation of an enumeration value to an value of the  enumeration.
Note: this method restricts  as a struct, instead of an , since  restricts on struct instead of .
Parses the string representation of an enumeration value to an value of the enumeration . Note : this method restricts as a struct instead of an since restricts on struct instead of .
public static TEnum Parse<TEnum>(string value)
            where TEnum : struct 
        {
            if (!Enum.TryParse(value, out TEnum output))
            {
                throw new Exception(EnumHelper.UnrecognizedEnumerationValueMessageLegacy<TEnum>(value));
            }
            return output;
        }
public static TEnum Parse < TEnum > ( string value ) where TEnum : struct { if ( ! Enum . TryParse ( value , out TEnum output ) ) { throw new Exception ( EnumHelper . UnrecognizedEnumerationValueMessageLegacy < TEnum > ( value ) ) ; } return output ; }
Parses the string representation of an enumeration value to an value of the  enumeration.
Parses the string representation of an enumeration value to an value of the enumeration .
// Must be a struct for the moment, since Enum.TryParse<TEnum> requires TEnum to be a struct.
value
string