ThrowIfEnumType Method
Definition
ThrowIfEnumType(Type, string, string)
Validates and throws an ArgumentException if the specified argument represents an enumeration.
public static void ThrowIfEnumType(Type argument, string message = "Value represents an enumeration.", string paramName = null)
Parameters
argumentTypeThe type to check is an enumeration.
messagestringA message that describes the error.
paramNamestringThe name of the type parameter that caused the exception.
Remarks
This method will not throw an exception if argument is null.
Exceptions
- ArgumentException
argumentrepresents an enumeration.
ThrowIfEnumType<TEnum>(string, string)
Validates and throws a TypeArgumentException if the specified TEnum represents an enumeration.
public static void ThrowIfEnumType<TEnum>(string typeParamName, string message = "Value 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 an enumeration.
Exceptions
- TypeArgumentException
TEnumrepresents an enumeration.