Modify a dictionary which I am iterating through
<pre><code>foreach(BruteforceEntry be in Entries.Values)
{
    if (be.AddedTimeRemove &lt;= now)
        Entries.Remove(be.IPAddress);
    else if (be.Unbantime &lt;= now &amp;&amp; be.Unbantime.Day == DateTime.Now.Day)
        Entries.Remove(be.IPAddress);
}
</code></pre>

<p>An exception was thrown:
Collection was modified; enumeration operation may not execute.
For some reason, it is not anymore.</p>

<p>EDIT:
I know you cannot remove something, while iterating through it this way, my question is hhow do I solve it?</p>
