title: Why is .ForEach() on IList<T> and not on IEnumerable<T>?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/101265/why-is-there-not-a-foreach-extension-method-on-the-ienumerable-interface">Why is there not a ForEach extension method on the IEnumerable interface?</a>  </p>
  </blockquote>
  
  
  
  <p>I've noticed when writing LINQ-y code that <code>.ForEach()</code> is a nice idiom to use.  For example, here is a piece of code that takes the following inputs, and produces these outputs:</p>
  
  <pre><code>{ "One" } =&gt; "One"
  { "One", "Two" } =&gt; "One, Two"
  { "One", "Two", "Three", "Four" } =&gt; "One, Two, Three and Four";
  </code></pre>
  
  <p>And the code:</p>
  
  <pre><code>private string InsertCommasAttempt(IEnumerable&lt;string&gt; words)
  {
      List&lt;string&gt; wordList = words.ToList();
      StringBuilder sb = new StringBuilder();
      var wordsAndSeparators = wordList.Select((string word, int pos) =&gt;
          {
              if (pos == 0) return new { Word = word, Leading = string.Empty };
              if (pos == wordList.Count - 1) return new { Word = word, Leading = " and " };
              return new { Word = word, Leading = ", " };
          });
  
      wordsAndSeparators.ToList().ForEach(v =&gt; sb.Append(v.Leading).Append(v.Word));
      return sb.ToString();
  }
  </code></pre>
  
  <p>Note the interjected <code>.ToList()</code> before the <code>.ForEach()</code> on the second to last line.</p>
  
  <p>Why is it that <code>.ForEach()</code> isn't available as an extension method on <code>IEnumerable&lt;T&gt;</code>?  With an example like this, it just seems weird.</p>