title: Is there any method like ForEach for IList?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/200574/linq-equivalent-of-foreach-for-ienumerablet">LINQ equivalent of foreach for IEnumerable&lt;T&gt;</a>  </p>
  </blockquote>
  
  
  
  <p><code>List&lt;T&gt;</code> has a method called <code>ForEach</code> which executes the passed action on each element of it. </p>
  
  <pre><code>var names = new List&lt;String&gt;{ "Bruce", "Alfred", "Tim", "Richard" };
  
  names.ForEach(p =&gt;  { Console.WriteLine(p); });
  </code></pre>
  
  <p>But what if <code>names</code> is not a <code>List&lt;T&gt;</code> but an <code>IList&lt;T&gt;</code>? <code>IList&lt;T&gt;</code> doesn't have a method like <code>ForEach</code>.</p>
  
  <p>Is there some alternative? </p>