[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 22:59:48 EDT 2008
https://bugzilla.novell.com/show_bug.cgi?id=428216
User jpryor at novell.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=428216#c1
Jonathan Pryor <jpryor at novell.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jpryor at novell.com
--- Comment #1 from Jonathan Pryor <jpryor at novell.com> 2008-09-21 20:59:48 MDT ---
I think we're reading MSDN completely differently.
They say:
The order of the values in the ValueCollection is unspecified, but it
is in the same order as the [keys] in KeyCollection.
To me, this says *nothing* about .Add() order.
To me, this says that given:
var d = new Dictionary<string,string> {
{ "a", "1" },
{ "b", "2" },
};
Then if the KeyCollection returns keys in the order {"a", "b"}, then
ValueCollection *must* return values in the order {"1", "2"}. Likewise, if
KeyCollection instead returns keys in the order {"b", "a"}, then the
ValueCollection *must* return values in the order {"2", "1"}.
Which is (1) sane (if d.Keys.ElementAt(0)=="a", would you really want
d.Values.ElementAt(0)=="2"?), and (2) what Dictionary<TKey, TValue> already
does.
--
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