Class EnumValidationExtensions
- Namespace
- Admonish
- Assembly
- Admonish.dll
Contains enum-related validation extension methods of ValidationResult.
public static class EnumValidationExtensions
- Inheritance
-
EnumValidationExtensions
- Inherited Members
Methods
IsDefined<TEnum>(ValidationResult, string, TEnum, string?)
Ensures that the specified value is defined in the specified enum type. When the check fails, adds an error message to the ValidationResult and associates it with the specified key.
public static ValidationResult IsDefined<TEnum>(this ValidationResult r, string key, TEnum value, string? message = null) where TEnum : Enum
Parameters
r
ValidationResultThe validation result.
key
stringThe key to associate the error with.
value
TEnumThe value to check.
message
stringAn optional error message.
Returns
- ValidationResult
The validation result.
Type Parameters
TEnum