c# foreach on a dictionary

143

foreach dictionary c# -

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

c# foreach on a dictionary -

foreach(var item in myDictionary)
{
  foo(item.Key);
  bar(item.Value);
}

Comments

Submit
0 Comments