Is there a way to keep the order of keys in a hashtable as they were added? Like a push/pop mechanism.
Example:
$hashtable = @{}
$hashtable.Add(\"Sw
The PowerShell 1 way is to add a hashtable member to retain the add order. There is no need to use System.Collections.Specialized.OrderedDictionary:
$Hash = New-Object PSObject
$Hash | Add-Member -MemberType NoteProperty -Name key1 -Value val1
$Hash | Add-Member -MemberType NoteProperty -Name key2 -Value val2
$Hash | Add-Member -MemberType NoteProperty -Name key3 -Value val3