[Mono-dev] [PATCH] null keys in Lookup<>
ermau
me at ermau.com
Tue Nov 10 15:43:01 EST 2009
In reviewing removing the else, I realized there was a bug to begin with.
Made your other requested changes, added a test for the bug and fixed it.
On Tue, Nov 10, 2009 at 13:36, Jb Evain <jb at nurv.fr> wrote:
> Hey,
>
> On 11/10/09, ermau <me at ermau.com> wrote:
> > .NET supports null keys for groupings in
> > Enumerable.ToLookup()/Lookup<>, here's a patch for review
> > to improve Mono compatibility.
>
> + Assert.IsTrue (l[null].Contains ("2"));
>
> Please add a space before indexing, like you do before calling a method.
>
> + }
> + else if (!dictionary.TryGetValue (key, out
> list)) {
>
> Put the else on the same line as the }
>
> + if (key == null && nullGrouping != null)
> + return nullGrouping;
> + else
> + {
> + IGrouping<TKey, TElement> group;
> + if (groups.TryGetValue (key, out
> group))
> + return group;
> + }
>
> Remove the else and move the code to the same level as the if.
>
> When it's done please go ahead and commit to trunk and mono-2-6.
>
> Thanks!
>
> --
> Jb Evain <jb at nurv.fr>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20091110/47e48aaa/attachment.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: System.Core.diff
Type: application/octet-stream
Size: 5136 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20091110/47e48aaa/attachment.obj
More information about the Mono-devel-list
mailing list