I have some data:
id=@(1,2,3)
name=@('Mark','Revekka','Johan')
Height=@(190,'',178)
How can I get one array like table?
1 Mark 190
2 Revekka
3 Johan 178
I want to get information like this:
$array[1].name
and add like this:
$array+=['Helena',168]
Is it possible?
You could do this:
$data = @(
[PSCustomObject]@{
Name = "Mark"
Height = 190
},
[PSCustomObject]@{
Name = "Revekka"
Height = ""
},
[PSCustomObject]@{
Name = "Johan"
Height = 178
}
)
$data[0].Name # returns Mark
#to add an item you can do
$data += [PSCustomObject]@{
Name = "Helena"
Height = 168
}
$data | ft -AutoSize
<# returns
Name Height
---- ----
Mark 190
Revekka
Johan 178
Helena 168
#>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With