title: Shallow copy of a hashset
body: <p>Whats the best way of doing it?</p>
  
  <pre><code>var set2 = new HashSet&lt;reference_type&gt;();
  </code></pre>
  
  <p>Traverse the set with a foreach like this.</p>
  
  <pre><code>foreach (var n in set)
      set2.Add(n);
  </code></pre>
  
  <p>Or use something like union like this.</p>
  
  <pre><code>set2 = set.UnionWith(set); // all the elements
  </code></pre>