ValidateSetAttribute ValidateSetAttribute ValidateSetAttribute Class

Definition

Validates that each parameter argument is present in a specified set

[System.AttributeUsage(System.AttributeTargets.Property | System.AttributeTargets.Field)]
public sealed class ValidateSetAttribute : System.Management.Automation.ValidateEnumeratedArgumentsAttribute
type ValidateSetAttribute = class
    inherit ValidateEnumeratedArgumentsAttribute
Public NotInheritable Class ValidateSetAttribute
Inherits ValidateEnumeratedArgumentsAttribute
Inheritance
Attributes

Constructors

ValidateSetAttribute(String[]) ValidateSetAttribute(String[]) ValidateSetAttribute(String[])

Initializes a new instance of the ValidateSetAttribute class

ValidateSetAttribute(Type) ValidateSetAttribute(Type) ValidateSetAttribute(Type)

Initializes a new instance of the ValidateSetAttribute class. Valid values is returned dynamically from a custom class implementing 'IValidateSetValuesGenerator' interface.

Properties

ErrorMessage ErrorMessage ErrorMessage

Gets or sets the custom error message that is displayed to the user

The item being validated and a text representation of the validation set is passed as the first and second formatting argument to the ErrorMessage formatting pattern.

[ValidateSet("A","B","C", ErrorMessage="The item '{0}' is not part of the set '{1}'.")
IgnoreCase IgnoreCase IgnoreCase

Gets a flag specifying if we should ignore the case when performing string comparison. The default is true.

ValidValues ValidValues ValidValues

Gets the valid values in the set.

Methods

Validate(Object, EngineIntrinsics) Validate(Object, EngineIntrinsics) Validate(Object, EngineIntrinsics) Inherited from ValidateEnumeratedArgumentsAttribute
ValidateElement(Object) ValidateElement(Object) ValidateElement(Object) Inherited from ValidateEnumeratedArgumentsAttribute

Applies to