[Mono-bugs] [Bug 383883] New: Looping through dictionary key value pairs is different on .NET vs. MonoMac vs. MonoWindows
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Fri Apr 25 14:28:21 EDT 2008
https://bugzilla.novell.com/show_bug.cgi?id=383883
Summary: Looping through dictionary key value pairs is different
on .NET vs. MonoMac vs. MonoWindows
Product: Mono: Class Libraries
Version: 1.9.0
Platform: All
OS/Version: All
Status: NEW
Severity: Normal
Priority: P5 - None
Component: CORLIB
AssignedTo: mono-bugs at lists.ximian.com
ReportedBy: jfrayne at blizzard.com
QAContact: mono-bugs at lists.ximian.com
Found By: ---
using System;
using System.Collections.Generic;
using System.Text;
namespace DictionaryTest
{
class Program
{
static void Main(string[] args)
{
Dictionary<string, string> dict = new
Dictionary<string, string>();
for (int ii = 0; ii < 20; ii++)
{
string num = ii.ToString();
dict.Add("k" + num, "v" + num);
Print(dict);
}
Console.WriteLine();
Console.WriteLine("--------------------------------------------------------------------");
Console.WriteLine();
dict.Clear();
for (int ii = 19; ii >= 0; ii--)
{
string num = ii.ToString();
dict.Add("k" + num, "v" + num);
Print(dict);
}
Console.Read();
}
static void Print(Dictionary<string, string> dict)
{
foreach (KeyValuePair<string, string> pair in dict)
{
Console.WriteLine(pair.Key + "," + pair.Value);
}
Console.WriteLine();
Console.WriteLine("---");
Console.WriteLine();
}
}
}
Expected: The key value pairs should remain in the order they were added.
Actual (MonoWindows): The order is correct after the 7th addition, but the 8th
pair is put at the beginning, followed by the 9th and 10th. When the 11th is
added the order completely changes in another way that is wrong.
Actual (MonoMac): Same behavior as MonoWindows for the first 10 pairs, but when
the 11th is added the order changes in a way that is different than both .NET
and MonoWindows.
--
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