【发布时间】:2016-03-04 12:05:37
【问题描述】:
我在 PowerShell 中实现 HashMap 时遇到问题。我已经使用
从 ReST 响应创建了 HasMap$response_connection_hashmap = $response_connection|foreach {
@{ $_.name = $_.id }
}
我正在使用成功验证 hasmap
$response_connection_hashmap.GetEnumerator()|Sort-Object Name
但是,在按键搜索值时,我在下面使用
$response_connection_hashmap.Item("Key01")
遇到错误
Exception getting "Item": "Cannot convert argument "index", with value:
"Key01", for "get_Item" to type "System.Int32": "Cannot convert value
"Key01" to type "System.Int32". Error: "Input string was not in a correct
format."""
【问题讨论】:
标签: rest powershell powershell-5.0