列舉鍵和鍵值對
列舉金鑰
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
}