VerificationRule Enum


指定如何在验证中使用由 VerificationAttribute 实例定义的条件表达式。Specifies how conditional expressions defined by an VerificationAttribute instance are used in verification.

public enum class VerificationRule
public enum VerificationRule
type VerificationRule = 
Public Enum VerificationRule


NotEmptyString 2

VerificationAttribute 实例中指定的条件表达式左侧不能空字符串 ("")。The conditional expression specified in an VerificationAttribute instance must have a left hand side that is not an empty string ("").

Prohibited 1

VerificationAttribute 实例中指定的条件表达式是被禁止的。The conditional expression specified in an VerificationAttribute instance is prohibited.

Required 0

VerificationAttribute 实例中指定的条件表达式是必需的。The conditional expression specified in an VerificationAttribute instance is required.


使用扩展类、成员或VerificationAttribute索引器时, 可以通过指定一个VerificationRule值来定义如何使用ConditionalPropertyConditionalValue属性定义的条件表达式。When using extending a class, member or indexer with a VerificationAttribute, you may define how the conditional expression, defined by the ConditionalProperty and ConditionalValue properties, is used by specifying one of the VerificationRule values. VerificationAttribute如果未VerificationRule指定, 则使用 "必需" 的默认值。If in the creation of the VerificationAttribute no VerificationRule is specified, the default value of Required is used.

验证规则的条件表达式的左侧是ConditionalProperty , 右侧ConditionalValue是。The left side of a verification rule's conditional expression is the ConditionalProperty and the right side is the ConditionalValue. 指定如何将与进行比较ConditionalValueVerificationConditionalOperator ConditionalPropertyThe VerificationConditionalOperator specifies how the ConditionalProperty is to be compared to the ConditionalValue.

Applies to

See also