ThrowIfNotEnumType Method
Definition
ThrowIfNotEnumType<TEnum>(string, string)
Validates and throws a TypeArgumentException if the specified TEnum does not represents an enumeration.
public static void ThrowIfNotEnumType<TEnum>(string typeParamName, string message = "Value does not represents an enumeration.")
Parameters
typeParamNamestringThe name of the type parameter that caused the exception.
messagestringA message that describes the error.
Type Parameters
TEnumThe type to check is not an enumeration.
Exceptions
- TypeArgumentException
TEnumdoes not represents an enumeration.
ThrowIfNotEnumType(Type, string, string)
Validates and throws an ArgumentException if the specified argument does not represents an enumeration.
public static void ThrowIfNotEnumType(Type argument, string message = "Value does not represents an enumeration.", string paramName = null)
Parameters
argumentTypeThe type to check is not an enumeration.
messagestringA message that describes the error.
paramNamestringThe name of the type parameter that caused the exception.
Exceptions
- ArgumentException
argumentdoes not represents an enumeration.