Windows 在powershell中创建包含字符串和列表的哈希映射?

Windows 在powershell中创建包含字符串和列表的哈希映射?,windows,powershell,hashmap,Windows,Powershell,Hashmap,在powershell中,如何创建包含字符串作为键和字符串列表作为值的hashmap 例如,在Java中,可以执行以下操作: Map<String, List<String> myMap = new HashMap<String, List<String>(); 但这不起作用 $myMap = @{ "Michigan"="Detroit"; "California" = "Sacremento","Hollywood";"Texas"="Austin" }

在powershell中,如何创建包含字符串作为键和字符串列表作为值的hashmap

例如,在Java中,可以执行以下操作:

Map<String, List<String> myMap = new HashMap<String, List<String>();
但这不起作用

$myMap = @{ "Michigan"="Detroit"; "California" = "Sacremento","Hollywood";"Texas"="Austin" } 
请注意,California如何将两个值指定给它的键。还请注意,如果您试图将其导出到csv,枚举器将跳过数组值,只将“System.Object[]”插入csv文件,这可能是它应该做的

更新

要动态更新列表

$myMap.California += "Compton"
我想出来了

$myList = New-Object Collections.Generic.List[string]
$myList.Add("one")
$myList.Add("two")
$myList.Add("three")

$myHash = @{ }
$myHash.Add("list", $myList)

我需要能够动态地将字符串添加到list@inquisitor你应该更新你的问题,但我已经更新了我的答案。
$myList = New-Object Collections.Generic.List[string]
$myList.Add("one")
$myList.Add("two")
$myList.Add("three")

$myHash = @{ }
$myHash.Add("list", $myList)