how properly remove item from list
<blockquote>
  <p><strong>Possible Duplicates:</strong><br>
  <a href="http://stackoverflow.com/questions/2545027/exception-during-iteration-on-collection-and-remove-items-from-that-collection">Exception during iteration on collection and remove items from that collection</a><br>
  <a href="http://stackoverflow.com/questions/1582285/how-to-remove-elements-from-a-generic-list-while-iterating-around-it">How to remove elements from a generic list while iterating around it?</a><br>
  <a href="http://stackoverflow.com/questions/1154325/better-way-to-remove-matched-items-from-a-list">Better way to remove matched items from a list</a>  </p>
</blockquote>



<pre><code>// tmpClientList is List&lt;Client&gt; type

if (txtboxClientName.Text != "")
    foreach (Client cli in tmpClientList)
        if (cli.Name != txtboxClientName.Text)
            tmpClientList.Remove(cli);
</code></pre>

<p>Error: "Collection was modified; enumeration operation may not execute."</p>

<p>How can i remove items from the list, in some simple way, without saving indexes of these items in another list or array, and removing them in another place in the code. Tried also RemoveAt(index) but it's exactly the same situation, modifying when loop runs.</p>
