foreach dictionary c# key value code example
Example 1: how to do a foreach loop in c# for dictionary
foreach (KeyValuePair<string, int> kvp in myDictionary)
{
print(kvp)
}
Example 2: c# dictionary loop key value
foreach(KeyValuePair<string, string> entry in myDictionary)
{
// do something with entry.Value or entry.Key
}