共用方式為


ValidationState Enumeration

Identifies whether instances of a class will be enabled for validation.

Namespace:  Microsoft.VisualStudio.Modeling.Validation
Assembly:  Microsoft.VisualStudio.Modeling.Sdk.10.0 (in Microsoft.VisualStudio.Modeling.Sdk.10.0.dll)

Syntax

'宣告
Public Enumeration ValidationState
public enum ValidationState
public enum class ValidationState
type ValidationState
public enum ValidationState

Members

Member name Description
Disabled Indicates that instances of the class to which this value is applied will not be checked by validation methods for this class.
Enabled Indicates that instances of the class to which this value is applied will be enabled for validation.
Inherited Indicates that instances of the class to which this value is applied will be enabled or disabled for validation based on the settings for their parent class.

Remarks

This enumeration is used as the argument to the class attribute ValidationStateAttribute.

You can apply the ValidationState.Disabled setting to a derived class whose parent is enabled for validation because derived classes have the ValidationState of their parent class by default.

For more information about validation, see Validation in a Domain-Specific Language.

Examples

The following example shows the ValidationState attribute using the ValidationState enumeration to enable validation to occur on the Person class.

[C#]

[ValidationState(ValidationState.Enabled)]
public partial class Person
{
    //Code goes here...
}

See Also

Reference

Microsoft.VisualStudio.Modeling.Validation Namespace