All,
So, I'm tinkering around with creating an array and then adding rows and I'm trying to understand this behavior.
For example:
If I do this:
$table = @()
$row = "" | Select Name,Value
$row.Name = "test"
$row.Value = "Prod"
$table += $row
$table
Name Value
---- -----
test Prod
It works. Then if i try to add another row with out initializing a new $row array it overwrites the original why?
$row.Name = "test2"
$row.Value = "NonProd"
$table += $row
$table
Name Value
---- -----
test2 NonProd
test2 NonProd
But if I do this it adds to bottom. Why does it behave this way where I have to reinitialize the row every time?
$row = "" | Select Name,Value
$row.Name = "test"
$row.Value = "Prod"
$table += $row
Name Value
---- -----
test2 NonProd
test2 NonProd
test Prod