[Mono-list] HashSet does not preserve add order
Andrus
kobruleht2 at hot.ee
Sat Jan 24 13:44:14 EST 2009
Code below produces different results in MONO and .NET .
How to fix ?
Andrus.
using System.Collections.Generic;
using System.Windows.Forms;
class AppMainEntry
{
static void Main()
{
HashSet<string> propList = new HashSet<string>();
propList.Add("valkogus");
propList.Add("toode");
string s = "";
foreach ( var r in propList )
{
s += r + ",";
}
// Observed: toode,valkogus,
// Expected: valkogus,toode,
MessageBox.Show(s);
}
}
More information about the Mono-list
mailing list