public static UnrecognizedEnumerationValueException From <T>(string unrecognizedValue, string message)
        {
            var enumerationTypeFullName = typeof(T).FullName;

            var exception = new UnrecognizedEnumerationValueException(enumerationTypeFullName, unrecognizedValue, message);

            return(exception);
        }
        public static UnrecognizedEnumerationValueException From <T>(string unrecognizedValue)
            where T : Enum
        {
            var message = EnumerationHelper.UnrecognizedEnumerationValueMessage <T>(unrecognizedValue);

            var exception = UnrecognizedEnumerationValueException.From <T>(unrecognizedValue, message);

            return(exception);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Produces an exception in the case where the string representation of a enumeration value is unrecognizable as one of the values of the <paramref name="enumerationTypeFullName"/> enumeration.
        /// Useful in the default case of a switch statement for parsing a string to an enumeration.
        /// </summary>
        public static UnrecognizedEnumerationValueException UnrecognizedEnumerationValueException(string enumerationTypeFullName, string unrecognizedValue)
        {
            var unrecognizedEnumerationValueException = new UnrecognizedEnumerationValueException(enumerationTypeFullName, unrecognizedValue);

            return(unrecognizedEnumerationValueException);
        }