The AllowNull attribute

AllowNull is used to permit explicit use of $null as a value for a Mandatory parameter:

function Test-AllowNull {
[CmdletBinding()]
param (
[Parameter(Mandatory)]
[AllowNull()]
[Object]$Parameter1
)
}

AllowNull is effective for array parameters, and for parameters that use Object as a type. AllowNull is not effective for string parameters as the null value is cast to an empty string, and an empty string is still not permitted.

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

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