以以下PowerShell为例:
$Properties = @{Name='Bob'; Title='Manager'; Ties=@('Red','Green','Corn flower blue', 'Magenta', 'Yellow')}
$Person = New-Object -TypeName PSObject -Property $Properties
$Person
Title Name Ties
----- ---- ----
Manager Bob {Red, Green, Corn flower blue, Magenta...}
有没有办法在控制台输出中展开数组,以便所有元素始终可见? E.g:
$Person
Title Name Ties
----- ---- ----
Manager Bob Red
Green
Corn flower blue
Magenta
Yellow
输出多个对象如下所示:
Title Name Ties
----- ---- ----
Manager Bob Red
Green
Corn flower blue
Magenta
Yellow
CEO Brad Green
Blue
Violet
Black
Red
Brown
Gray
Vermilion
Sales John White
Off-white
Mother of pearl