$out = @()
$base = New-Object PSObject -Properties @{
'Name' = ''
'Version' = ''
'Foo' = ''
}
$one = $base
$one.Name = "test"
$one.Version = "1"
$one.Foo = "bar"
$out += $one
$two = $base
$two.Name = "test 2"
$two.Version = "2"
$two.Foo = "bar2"
$out += $twoThe above does not work as written. $out ends up being only 2 objects that have the same values. But I'm just wondering if there is a simple/elegant way to "stage" an object and then reuse it multiple times in this fashion?
Thanks!
Edit: It's almost like a need a "new" constructor.