Xarzu Member Apr 11, 2008 46 2 71 Aug 22, 2012 #1 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?
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?
KLin Lifer Feb 29, 2000 30,106 484 126 Aug 22, 2012 #2 http://www.dotnetperls.com/dictionary foreach section should help.
W winstongel Junior Member Aug 1, 2014 5 0 16 Aug 1, 2014 #3 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 Xarzu said: 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? Click to expand... 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: Aug 1, 2014
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 Xarzu said: 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? Click to expand... 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