The ValidateNotNullOrEmpty attribute

ValidateNotNullOrEmpty extends ValidateNotNull to disallow empty arrays and empty strings:

function Test-ValidateNotNullOrEmpty {
[CmdletBinding()]
param (
[ValidateNotNullOrEmpty()]
[String]$Parameter1,

[ValidateNotNullOrEmpty()]
[Object[]]$Parameter2
)
}

An error will be thrown if either an empty string is supplied for Parameter1, or an empty array is supplied for Parameter2Like ValidateNotNull, ValidateNotNullOrEmpty has no effect on numeric types.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.223.32.230