From: Jérémie Laval Date: Tue, 4 Sep 2012 11:12:00 +0000 (+0100) Subject: [System.Core] Remove generic indirection for ToList X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=db21dd426be9aef682aeae21d0eac3935ece3f85;p=mono.git [System.Core] Remove generic indirection for ToList --- diff --git a/mcs/class/System.Core/System.Linq/ParallelEnumerable.cs b/mcs/class/System.Core/System.Linq/ParallelEnumerable.cs index d85d30c24c6..6236f485baa 100644 --- a/mcs/class/System.Core/System.Linq/ParallelEnumerable.cs +++ b/mcs/class/System.Core/System.Linq/ParallelEnumerable.cs @@ -1912,13 +1912,39 @@ namespace System.Linq if (source.Node.IsOrdered ()) return ToListOrdered (source); - List temp = source.Aggregate (() => new List(50), - (list, e) => { list.Add (e); return list; }, - (list, list2) => { list.AddRange (list2); return list; }, - (list) => list); + var helper = new ListAggregateHelper (); + List temp = source.Aggregate (helper.Seed, + helper.Intermediate, + helper.Reducer, + helper.Final); return temp; } + class ListAggregateHelper + { + public List Seed () + { + return new List (50); + } + + public List Intermediate (List list, TSource e) + { + list.Add (e); + return list; + } + + public List Reducer (List list, List list2) + { + list.AddRange (list2); + return list; + } + + public List Final (List list) + { + return list; + } + } + internal static List ToListOrdered (this ParallelQuery source) { List result = new List ();