ValidateScriptAttribute ValidateScriptAttribute ValidateScriptAttribute ValidateScriptAttribute Class

Definition

Class for validating against a script block.

public ref class ValidateScriptAttribute sealed : System::Management::Automation::ValidateEnumeratedArgumentsAttribute
public sealed class ValidateScriptAttribute : System.Management.Automation.ValidateEnumeratedArgumentsAttribute
type ValidateScriptAttribute = class
    inherit ValidateEnumeratedArgumentsAttribute
Public NotInheritable Class ValidateScriptAttribute
Inherits ValidateEnumeratedArgumentsAttribute
Inheritance

Constructors

ValidateScriptAttribute(ScriptBlock) ValidateScriptAttribute(ScriptBlock) ValidateScriptAttribute(ScriptBlock) ValidateScriptAttribute(ScriptBlock)

Initializes a new instance of the ValidateScriptBlockAttribute class

Properties

ErrorMessage ErrorMessage ErrorMessage ErrorMessage

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

The item being validated and the validating scriptblock is passed as the first and second formatting argument.

[ValidateScript("$_ % 2", ErrorMessage = "The item '{0}' did not pass validation of script '{1}'")]
ScriptBlock ScriptBlock ScriptBlock ScriptBlock

Gets the scriptblock to be used in the validation

Methods

Validate(Object, EngineIntrinsics) Validate(Object, EngineIntrinsics) Validate(Object, EngineIntrinsics) Validate(Object, EngineIntrinsics)

Calls ValidateElement in each element in the enumeration argument value.

(Inherited from ValidateEnumeratedArgumentsAttribute)
ValidateElement(Object) ValidateElement(Object) ValidateElement(Object) ValidateElement(Object)

Overridden by subclasses to implement the validation of each parameter argument

(Inherited from ValidateEnumeratedArgumentsAttribute)

Applies to