[Mono-bugs] [Bug 428216] [PATCH] return Dictionary keys as in added order

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sun Sep 21 23:54:46 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=428216

User atsushi at ximian.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=428216#c2





--- Comment #2 from Atsushi Enomoto <atsushi at ximian.com>  2008-09-21 21:54:46 MDT ---
Oops, you're right on that values should return in the same order as keys do.
BTW this is the repro code what I received from a user (and I somewhat
modified):

using System;
using System.Collections.Generic;

class Test
{
 static void Main()
 {
   var dict = new Dictionary<string, int>();
   dict.Add("z", 1);
   dict.Add("a", 2);
   dict.Add("c", 3);
   dict.Add("d", 4);
   dict.Add("f", 5);
   dict.Add("e", 6);
   dict.Add("g", 7);
   dict.Add("h", 8);
   dict.Add("i", 9);
   dict.Add("j", 8);
   dict.Add("k", 7);
   dict.Add("l", 6);
   dict.Add("m", 5);
   dict.Add("n", 4);
   dict.Add("o", 3);
   dict.Add("p", 2);
   dict.Add("q", 1);
   dict.Add("r", 0);
   dict.Add("s", 1);
   dict.Add("t", 2);
   dict.Add("y", 3);
   dict.Add("u", 4);
   dict.Add("x", 5);
   dict.Add("v", 6);
   foreach (var n in dict.Keys)
     Console.WriteLine(n.ToString());
   foreach (var n in dict.Values)
     Console.WriteLine(n.ToString());
   }
}


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list