[Mono-dev] [PATCH] null keys in Lookup<>

Jb Evain jb at nurv.fr
Tue Nov 10 13:36:41 EST 2009


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.


Jb Evain  <jb at nurv.fr>

More information about the Mono-devel-list mailing list