In powershell, if a object returns multiple values for one element, then I can't figure out how to separate those values.
So, for example:
'1' | %{@("ValueC_$_.1","ValueC_$_.2","ValueC_$_.3")[0]}
Returns ValueC_1.1 as I would expect. But..
$Object = [System.Collections.ArrayList]@()
(1..4) | %{
$null = $object.Add([pscustomobject] @{
"PropertyA"="ValueA_$_"
"PropertyB"="ValueB_$_"
"PropertyC"=@("ValueC_$_.1","ValueC_$_.2","ValueC_$_.3")
})
}
$Object | Select-Object PropertyC -First 1 | %{$_[0]}
Returns this instead:
{ValueC_1.1, ValueC_1.2, ValueC_1.3}
So, how do I separate each of those subvalues and specify just the first value of each object?