title: Why is AddRange faster than using a foreach loop?
body: <pre><code>var fillData = new List&lt;int&gt;();
  for (var i = 0; i &lt; 100000; i++)
       fillData.Add(i);
  
  var stopwatch1 = new Stopwatch();
  stopwatch1.Start();
  
  var autoFill = new List&lt;int&gt;();
  autoFill.AddRange(fillData);
  stopwatch1.Stop();
  
  var stopwatch2 = new Stopwatch();
  stopwatch2.Start();
  
  var manualFill = new List&lt;int&gt;();
  
  foreach (var i in fillData)
      manualFill.Add(i);
  stopwatch2.Stop();
  </code></pre>
  <p>When I take <strong>4</strong> results from <code>stopwach1</code> and <code>stopwach2</code>, <code>stopwatch1</code> has always lower value than <code>stopwatch2</code>. That means <code>addrange</code> is always faster than <code>foreach</code>.
  Does anyone know why?</p>