Compartilhar via


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.Field | System.AttributeTargets.Property)]
public sealed class ValidateSetAttribute : System.Management.Automation.ValidateEnumeratedArgumentsAttribute
[<System.AttributeUsage(System.AttributeTargets.Field | System.AttributeTargets.Property)>]
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 are returned dynamically from a custom class implementing IValidateSetValuesGenerator

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 valid values in the set.

Methods

Validate(Object, EngineIntrinsics)

Calls ValidateElement in each element in the enumeration argument value.

(Inherited from ValidateEnumeratedArgumentsAttribute)
ValidateElement(Object)

Abstract method to be overridden by subclasses, implementing the validation of each parameter argument.

(Inherited from ValidateEnumeratedArgumentsAttribute)

Applies to