Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想创建一个需要哈希表的函数。
我怎样才能做到这一点?
function ([string]foo, [#what to write here]myHAshTable)
我认为您不需要指定类型(即 [hashtable] - 只要您在函数中正确引用哈希,您就可以传递变量。例如,传递哈希表参数 $hash:
foreach ($key in $hash.Keys){ Write-Host $hash[$key] }
这?
function ([string]$foo, [hashtable]$myHAshTable)