C# – How to Iterate Over a Dictionary

c++dictionaryloops

I've seen a few different ways to iterate over a dictionary in C#. Is there a standard way?

Best Answer

foreach(KeyValuePair<string, string> entry in myDictionary)
{
    // do something with entry.Value or entry.Key
}
Related Question