ValidateSetAttribute Class

Definition

Validates that each parameter argument is present in a specified set

public ref class ValidateSetAttribute sealed : System::Management::Automation::ValidateEnumeratedArgumentsAttribute
[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[])

Initializes a new instance of the ValidateSetAttribute class

ValidateSetAttribute(Type)

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

Properties

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

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

ValidValues

Gets the values in the set

Methods

Validate(Object, EngineIntrinsics)

Calls ValidateElement in each element in the enumeration argument value.

(Inherited from ValidateEnumeratedArgumentsAttribute)
ValidateElement(Object)

Overridden by subclasses to implement the validation of each parameter argument

(Inherited from ValidateEnumeratedArgumentsAttribute)

Applies to