EN
이 콘텐츠는 한국어로 제공되지 않아 영어 버전으로 표시됩니다.

ValidateCount Attribute Declaration

The ValidateCount attribute specifies the minimum and maximum number of arguments allowed for a cmdlet parameter.

[ValidateCount(int minLength, int maxlength)]

Parameters

MinLength (Int32)
Required. Specifies the minimum number of arguments.

MaxLength(Int32)
Required. Specifies the maximum number of arguments.

  • For more information about how to declare this attribute, see How to Declare Input Validation Rules.

  • When this attribute is not invoked, the corresponding cmdlet parameter can have any number of arguments.

  • The Windows PowerShell runtime throws an error under the following conditions:

    • The MinLength and MaxLength attribute parameters are not of type Int32.

    • The value of the MaxLength attribute parameter is less than the value of the MinLength attribute parameter.

  • The ValidateCount attribute is defined by the ValidateCount class.

Reference

ValidateCount

Other Resources

How to Declare Input Validation Rules
Writing a Windows PowerShell Cmdlet



커뮤니티 추가 항목

추가
표시:
© 2015 Microsoft