internal/configurationvalidation/integerarray.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Register-PSFConfigValidation -Name "integerarray" -ScriptBlock {
    param (
        $var
    )
    
    $test = $true
    try { [int[]]$res = $var }
    catch { $test = $false }
    
    [pscustomobject]@{
        Success = $test
        Value   = $res
        Message = "Casting $var as [int[]] failure. Input is being identified as $($var.GetType())"
    }
}