What is the standard and most effective way to iterate over a Dictionary in C#?

I searched for a reference online and found few ways to iterate over a Dictionary in C#. What is the standard way to do this?

Comments

  • foreach(KeyValuePair<string, string> entry in YourDictionaryName)
    {
        // Manipulate entry.Value or entry.Key as you wish
    }
    
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion