$hash = @{
Prop1 = 'Value1'
Prop2 = 'Value2'
Prop3 = 'Value3'
}
$CustomObject = [pscustomobject]$hash
$hash = @{
Prop1 = 'Value1'
Prop2 = 'Value2'
Prop3 = 'Value3'
}
$CustomObject = [pscustomobject]$hash
list are allways to be used what the collection has to grow or shrink.
arrays should be used only when the collection have a fixed length and it will not change.
[System.Collections.Generic.List[string]]::new()
[System.Collections.Generic.List[int]]::new()
[System.Collections.Generic.List[Object]]::new()
(Measure-Command -Expression { [void]$(1..100000) }).Milliseconds
53
(Measure-Command -Expression { $null = $(1..100000) }).Milliseconds
49
(Measure-Command -Expression { $(1..100000) > $null }).Milliseconds
62
(Measure-Command -Expression { $(1..100000) | Out-Null }).Milliseconds
393