[Mono-dev] [PATCH] null keys in Lookup<>
ermau
me at ermau.com
Tue Nov 10 19:20:44 EST 2009
So, note to self, don't write BCL code when distracted and you should be
doing other things. Added a few more tests and fixed Contains and
GetEnumerator.
On Tue, Nov 10, 2009 at 15:43, ermau <me at ermau.com> wrote:
> 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/a5a87258/attachment-0001.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: System.Core.diff
Type: application/octet-stream
Size: 7347 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20091110/a5a87258/attachment-0001.obj
More information about the Mono-devel-list
mailing list