ValidateArgumentsAttribute Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Serves as the base class for Validate attributes that validate parameter arguments.
public ref class ValidateArgumentsAttribute abstract : System::Management::Automation::Internal::CmdletMetadataAttribute
[System.AttributeUsage(System.AttributeTargets.Field | System.AttributeTargets.Property)]
public abstract class ValidateArgumentsAttribute : System.Management.Automation.Internal.CmdletMetadataAttribute
[<System.AttributeUsage(System.AttributeTargets.Field | System.AttributeTargets.Property)>]
type ValidateArgumentsAttribute = class
inherit CmdletMetadataAttribute
Public MustInherit Class ValidateArgumentsAttribute
Inherits CmdletMetadataAttribute
- Inheritance
- Derived
- Attributes
Remarks
Argument validation attributes can be attached to Cmdlet and CmdletProvider parameters to ensure that the Cmdlet or CmdletProvider will not be invoked with invalid values of the parameter. Existing validation attributes include ValidateCountAttribute, ValidateNotNullAttribute, ValidateNotNullOrEmptyAttribute, ValidateArgumentsAttribute, ValidateLengthAttribute, ValidateRangeAttribute, ValidatePatternAttribute, and ValidateSetAttribute. PSSnapins wishing to create custom argument validation attributes should derive from ValidateArgumentsAttribute and override the Validate(Object, EngineIntrinsics) abstract method, after which they can apply the attribute to their parameters. ValidateArgumentsAttribute validates the argument as a whole. If the argument value may be an enumerable, you can derive from ValidateEnumeratedArgumentsAttribute which will take care of unrolling the enumerable and validate each element individually. It is also recommended to override ToString() to return a readable string similar to the attribute declaration, for example "[ValidateRangeAttribute(5,10)]". If this attribute is applied to a string parameter, the string command argument will be validated. If this attribute is applied to a string[] parameter, the string[] command argument will be validated.
Constructors
ValidateArgumentsAttribute() |
Initializes a new instance of a class derived from ValidateArgumentsAttribute. |
Methods
Validate(Object, EngineIntrinsics) |
Verify that the value of |