I create an ArrayList and add one single element to it. Where does the zero at index 0 come from? What would be a best practice to add an element without adding the ominous zero?
function Get-List() {
$some_list = [System.Collections.ArrayList]@()
$some_list.Add(@{
'some'='a'
'data'='b'
'added'='c'
})
return $some_list
}
(Get-List).Count # This is 2
(Get-List)[0] # This is an int32 zero
(Get-List)[1] # This is the object I expected at index 0