Thursday, 25 August 2016

c# - What is the best way to iterate over a dictionary?




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


Answer



foreach(KeyValuePair entry in myDictionary)
{
// do something with entry.Value or entry.Key
}

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...