title: HashSet Iterating While Removing Items in C#
body: <p>I have a hashset in C# that I'm removing from if a condition is met while iterating though the hashset and cannot do this using a foreach loop as below.</p>
  
  <pre><code>foreach (String hashVal in hashset) 
  {
       if (hashVal == "somestring") 
       {
              hash.Remove("somestring");
       }
  }
  </code></pre>
  
  <p>So, how can I remove elements while iterating?</p>