You have some options here.
Enumerating through keys:
foreach ($key in $var.Keys) {
$value = $var[$key]
# or
$value = $var.$key
}
Enumerating key-value pairs (which you’ve discovered, but may not be using effectively):
foreach ($kvp in $var.GetEnumerator()) {
$key = $kvp.Key
$val = $kvp.Value
}