ThrowIfNotEnum Method
Definition
ThrowIfNotEnum<TEnum>(string, bool, string, string)
Validates and throws an ArgumentException if the specified argument does not represents an enumeration.
public static void ThrowIfNotEnum<TEnum>(string argument, bool ignoreCase = true, string message = "Value does not represents an enumeration.", string paramName = null) where TEnum : struct, IConvertible
Parameters
argumentstringThe value to be evaluated.
ignoreCasebooltrueto ignore case;falseto regard case.messagestringA message that describes the error.
paramNamestringThe name of the parameter that caused the exception.
Type Parameters
TEnumThe type of the enumeration.
Exceptions
- ArgumentException
argumentdoes not represents an enumeration.