HashSet<T>对集合运算的操作
HashSet<T>是一个Set集合,虽然List、Collection也叫集合,但Set集合和它们却大有不同。
HashSet<T>提供了和“Set集合运算”相关的方法,如:
IntersectWith (IEnumerable<T> other) (交集)
public void IntersectWithTest() { HashSet<int> set1 = new HashSet<int>() { 1, 2, 3 };
HashSet<int> set2 = new HashSet<int>() { 2, 3, 4 };
set1.IntersectWith(set2);
foreach (var item in set1)
{ 


