iterate through dictionary c#
foreach(var item in myDictionary)
{
foo(item.Key);
bar(item.Value);
}
iterate through dictionary c#
foreach(var item in myDictionary)
{
foo(item.Key);
bar(item.Value);
}
dictionary c#
// Create a dictionary with 2 string values
Dictionary<string, string> capitalOf = new Dictionary<string, string>();
// Add items to the dictionary
capitalOf.Add("Japan", "Tokio");
capitalOf.Add("Portugal", "Lissabon");
// Loop over the dictionary and output the results to the console
foreach (KeyValuePair<string, string> combi in capitalOf)
{
Console.WriteLine("The capital of " + combi.Key + " is " + combi.Value);
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us