alx*_*x9r 5 arrays powershell null types
考虑这段代码
"Type: array"
$v = @()
" -eq `$null: $($v -eq $null)"
" -ne `$null: $($v -ne $null)"
"Type: string"
$v = ''
" -eq `$null: $($v -eq $null)"
" -ne `$null: $($v -ne $null)"
Run Code Online (Sandbox Code Playgroud)
产生以下结果:
Type: array
-eq $null:
-ne $null:
Type: string
-eq $null: False
-ne $null: True
Run Code Online (Sandbox Code Playgroud)
为什么-eq和-ne像预期的那样一个空字符串,但评价为空或空的空数组?
更重要的是,你如何区分$null和空数组?
| 归档时间: |
|
| 查看次数: |
2204 次 |
| 最近记录: |