VerificationRule VerificationRule VerificationRule 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 NotEmptyString NotEmptyString NotEmptyString 2

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

Prohibited Prohibited Prohibited Prohibited 1

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

Required Required Required Required 0

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


使用扩展类、 成员或使用索引器时VerificationAttribute,可以定义的条件表达式,如何通过定义ConditionalPropertyConditionalValue属性,指定一个使用VerificationRule值。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和右侧是ConditionalValueThe left side of a verification rule's conditional expression is the ConditionalProperty and the right side is the ConditionalValue. VerificationConditionalOperator指定如何ConditionalProperty与比较ConditionalValueThe VerificationConditionalOperator specifies how the ConditionalProperty is to be compared to the ConditionalValue.