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
rValidationResultThe validation result.
keystringThe key to associate the error with.
valueTEnumThe value to check.
messagestringAn optional error message.
Returns
- ValidationResult
The validation result.
Type Parameters
TEnum