About Ordered
OrderedDictionary is made available in PowerShell by using the [Ordered] keyword. This was introduced along with PSCustomObject in PowerShell 3.
An OrderedDictionary preserves the order in which keys were added. For example:
$ordered = [Ordered]@{ One = 1 Two = 2 Three = 3 } Viewing the value of $ordered will show the keys appear in the same order they were entered:
PS> $ordered Name Value ---- ----- One 1 Two 2 Three 3 Conversely, a hashtable may show the keys in a different order:
PS> @{ One = 1; Two = 2; Three = 3 } Name Value ---- ----- Two 2 Three 3 One 1 In PowerShell 7, a type accelerator exists for [Ordered], which makes the derivation of the type fairly...