Have you noticed something? Key should be always string, however in this case, PowerShell doesn’t convert it automatically. Surprisingly, this allows us to have 2 keys with same name – something that should never happen ;)

PS C:\> $Collection."9" = 9PS C:\> $Collection.Keys998

Ok, and here comes solution. Whenever you assign key, specify that it is string: