枚举键和键值对
枚举密钥
foreach ($key in $var1.Keys) {
$value = $var1[$key]
# or
$value = $var1.$key
}
枚举键值对
foreach ($keyvaluepair in $var1.GetEnumerator()) {
$key1 = $_.Key1
$val1 = $_.Val1
}
foreach ($key in $var1.Keys) {
$value = $var1[$key]
# or
$value = $var1.$key
}
foreach ($keyvaluepair in $var1.GetEnumerator()) {
$key1 = $_.Key1
$val1 = $_.Val1
}