[System.Core] Remove a source of generic indirection for GroupBy
authorJérémie Laval <jeremie.laval@gmail.com>
Wed, 5 Sep 2012 13:36:58 +0000 (14:36 +0100)
committerJérémie Laval <jeremie.laval@gmail.com>
Wed, 5 Sep 2012 13:41:46 +0000 (14:41 +0100)
mcs/class/System.Core/System.Linq/ParallelEnumerable.cs

index 6d9e637b4c9fd04992ffef6b8fdb0f4ef5eed87f..63eea9afd95efe1c10e82eb24c7535f5b563506e 100644 (file)
@@ -608,7 +608,7 @@ namespace System.Linq
                                                                                              Func<TSource, TKey> keySelector,
                                                                                              IEqualityComparer<TKey> comparer)
                {
-                       return source.GroupBy (keySelector, (e) => e, comparer);
+                       return source.GroupBy (keySelector, new Identity<TSource> ().Apply, comparer);
                }
                
                public static ParallelQuery<IGrouping<TKey, TElement>> GroupBy<TSource, TKey, TElement> (this ParallelQuery<TSource> source,
@@ -2243,6 +2243,17 @@ namespace System.Linq
                        throw new NotSupportedException ();
                }
                #endregion
+
+               #region Helpers
+
+               class Identity<T>
+               {
+                       public T Apply (T input)
+                       {
+                               return input;
+                       }
+               }
+               #endregion
        }
 }
 #endif