Jake Stewart Jake Stewart - 2 months ago 7
C# Question

What is the best way to iterate over a Dictionary in C#?

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

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