Loop through an "associative" generic dictionary

How do you loop through a generic dictionary and be able to get both the key and value of each element? (Please provide a general case that works even if the dictionary does not have integer keys.)

What I generally do is: I loop through the keys via an interator. Then in the loop-body I use the key to fetch the value from the dictionary.

If performance is an issue, there might be better solutions though. :slight_smile: