Data dictionaries Flashcards
1
Q
How do you add elements to a data dictionary?
A
students.Add(“Johdn”, “C”);
2
Q
How do you create a data dictionary?
A
Dictionary<string, string> students = new Dictionary<string, string>();
3
Q
How do you traverse a data dictionary?
A
foreach(KeyValuePair<string, string> kvp in students)
{
Console.WriteLine($”{kvp.Key}, {kvp.Value}”);
}