title: Parallel Aggregate Collection
body: <p>I have seen code for parallel aggregation for basic types, e.g.</p>
  
  <pre><code>Parallel.For&lt;int&gt;(0, result.Count, () =&gt; 0, (i, loop, subtotal) =&gt;
      {
          subtotal += result[i];
          return subtotal;
      },
      (x) =&gt; Interlocked.Add(ref sum, x)
  );
  </code></pre>
  
  <p>I was wondering if there was an equivalent for a list/other collection e.g:</p>
  
  <pre><code>List&lt;Result&gt; AllResults;
  Parallel.ForEach(allIDs, (currentID) =&gt;
  {
  
      subList.add(GetResultFor(currentID));
      return subList;
  },
  (x) =&gt;
  {
      lock(AllResults)
          AllResults.AddRange(subList);
  };
  </code></pre>
  
  <p>I am guessing there is nothing that nice and neat but I can't think of another way of doing it, certainly not through a standard parralel.ForEach because I cant think of how you would say "this core have this range, this core this range"....</p>