立即查找定义为文字的散列 table 中的值
Immediate lookup of value in a hash table defined as a literal
获得散列 table 文字并立即在其中查找值的最短且最好的方法是什么?
例如我期待
$city = @{"30328" = "Atlanta"; "60608" = "Chicago"} [$zipCode]
但结尾是:
Unexpected token '[$zipCode]' in expression or statement.
只需删除 space:
$city = @{"30328" = "Atlanta"; "60608" = "Chicago"}[$zipCode]
或
$city = @{"30328" = "Atlanta"; "60608" = "Chicago"}.$zipCode
获得散列 table 文字并立即在其中查找值的最短且最好的方法是什么?
例如我期待
$city = @{"30328" = "Atlanta"; "60608" = "Chicago"} [$zipCode]
但结尾是:
Unexpected token '[$zipCode]' in expression or statement.
只需删除 space:
$city = @{"30328" = "Atlanta"; "60608" = "Chicago"}[$zipCode]
或
$city = @{"30328" = "Atlanta"; "60608" = "Chicago"}.$zipCode