In C#, how do you output the contents of a Dictionary class?

Status
Not open for further replies.

Xarzu

Member
Apr 11, 2008
46
2
71
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?
 

winstongel

Junior Member
Aug 1, 2014
5
0
16
Use for..each loop

foreach (KeyValuePair pair in dict){ MessageBox.Show(pair.Key.ToString ()+ " - " + pair.Value.ToString () );}
More about C# Dictionary ...http://csharp.net-informations.com/collection/dictionary.htm

Winston

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?

Welcome to the AT Forums. But for future reference, please do not bump old threads. This thread has been dead for 2 years now.

-Thanks
ViRGE
Sr. Mod
 
Last edited by a moderator:
Status
Not open for further replies.