 <p>You need to refresh the collection after removing element. Try to change your code like below and see if it works:</p> <p><strong>Code:</strong></p> <pre><code>var newList = invo; foreach (IGrouping&lt;string, InvoiceCount&gt; invoice in invo) { for (var line = 1; line &lt; invoice.Count(); line++) { if (YOUR CONDITION HERE) { newList.Remove(invoice ); invo= newList; } } } </code></pre> <hr> <p><strong>Note:</strong> <a href="https://topherlandry.wordpress.com/2013/05/14/how-to-modify-a-collection-during-iteration-in-c/" rel="nofollow">How to modify a collection during iteration</a></p>