http://bugzilla.novell.com/show_bug.cgi?id=612858
http://bugzilla.novell.com/show_bug.cgi?id=612858#c0 Summary: Foreach over a generic dictionary is not ordered the same way under linux and windows Classification: Mono Product: Mono: Class Libraries Version: 1.2.0 Platform: x86-64 OS/Version: Mandrake 7.0 Status: NEW Severity: Normal Priority: P5 - None Component: System AssignedTo: [email protected] ReportedBy: [email protected] QAContact: [email protected] Found By: --- Blocker: --- User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; de; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 If you use a foreach for iteration over a dictionary, the sort order is not the same on windows as on linux. Sample Code: Dictionary<int,string> _blub = new Dictionary<int, string>(); static void Main(string[] args) { Program p = new Program(); p.TestDict(); } private void TestDict() { _blub.Add(3, "first"); _blub.Add(2,"second"); _blub.Add(4,"third"); _blub.Add(0, "fourth"); foreach (KeyValuePair<int, string> valuePair in _blub) { Console.WriteLine("{0} : {1}", valuePair.Key, valuePair.Value); } Console.ReadLine(); } Result on linux: sun...@suntsu:~$ mono MonoDictTest.exe 0 : fourth 2 : second 3 : first 4 : third Result on windows: 3 : first 2 : second 4 : third 0 : fourth On windows the default order is the same as the items were added, on linux, the default order is the key. cheers manuel Reproducible: Always Steps to Reproduce: 1. 2. 3. -- Configure bugmail: http://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. _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
