Dim instance As ValidateRangeAttribute
<AttributeUsageAttribute(AttributeTargets.Property Or AttributeTargets.Field)> _ Public NotInheritable Class ValidateRangeAttribute Inherits ValidateEnumeratedArgumentsAttribute
[AttributeUsageAttribute(AttributeTargets.Property|AttributeTargets.Field)] public sealed class ValidateRangeAttribute : ValidateEnumeratedArgumentsAttribute
[AttributeUsageAttribute(AttributeTargets::Property|AttributeTargets::Field)] public ref class ValidateRangeAttribute sealed : public ValidateEnumeratedArgumentsAttribute
/** @attribute AttributeUsageAttribute(AttributeTargets.Property|AttributeTargets.Field) */ public final class ValidateRangeAttribute extends ValidateEnumeratedArgumentsAttribute
AttributeUsageAttribute(AttributeTargets.Property|AttributeTargets.Field) public final class ValidateRangeAttribute extends ValidateEnumeratedArgumentsAttribute
This example specifies a range of 0 to 5 for the InputData parameter.
[ValidateRange(0, 5)] [Parameter(Position = 0, Mandatory = true)] public int InputData { get { return inputData; } set { inputData = value; } } private int inputData;
There are no established scenarios for explicitly creating a ValidateRangeAttribute object from within a cmdlet. The ValidateRangeAttribute object is created and used indirectly when the attribute is declared.
The cmdlet declares this attribute when implementing a cmdlet parameter. For more information about the syntax and parameters used to declare this attribute within a cmdlet, see ValidateRange Attribute Declaration.