In C#, how do you output the contents of a Dictionary class?
Once you have loaded a Dictionary class with keys and values, how do I cycle through them and output the individual values in a foreach loop?
Printable View
In C#, how do you output the contents of a Dictionary class?
Once you have loaded a Dictionary class with keys and values, how do I cycle through them and output the individual values in a foreach loop?
A Dictionaty object has a propery called Keys.
so go like this
Code:var dic = new Dictionaty<string, string>();
foreach (var key in dic.Keys) {
Console.WriteLine(key);
}