FluentValidationExtensions.

IsOneOf<T, TProperty>(IRuleBuilder<T, TProperty>, bool, string[]) Method

Summary

Defines a validator on the current rule builder that ensures that the specific value is one of the values given in the list.

Syntax

public static IRuleBuilderOptions<T, TProperty> IsOneOf<T, TProperty>(this IRuleBuilder<T, TProperty> ruleBuilder, bool caseSensitive, params string[] values)

Type Parameters

Name Description
T Type of Enum being validated
TProperty Type of property being validated

Parameters

Name Type Description
ruleBuilder IRuleBuilder<T, TProperty> The rule builder on which the validator should be defined
caseSensitive bool If the comparison between the string and the enum names should be case sensitive
values string[] The values to match against

Return Value

Type Description
IRuleBuilderOptions<T, TProperty>