#unity/日常积累 ## 定义 命名空间: [System.Collections.Generic](https://learn.microsoft.com/zh-cn/dotnet/api/system.collections.generic?view=net-8.0) 程序集: System.Collections.dll 修改当前 [HashSet](https://learn.microsoft.com/zh-cn/dotnet/api/system.collections.generic.hashset-1?view=net-8.0) 对象以包含存在于该对象中、指定集合中或两者中的所有元素。 #### 参数 other [IEnumerable](https://learn.microsoft.com/zh-cn/dotnet/api/system.collections.generic.ienumerable-1?view=net-8.0) 要与当前的 [HashSet](https://learn.microsoft.com/zh-cn/dotnet/api/system.collections.generic.hashset-1?view=net-8.0) 对象进行比较的集合。 [](https://learn.microsoft.com/zh-cn/dotnet/api/system.collections.generic.hashset-1.unionwith?view=net-8.0#--) #### 实现 [UnionWith(IEnumerable)](https://learn.microsoft.com/zh-cn/dotnet/api/system.collections.generic.iset-1.unionwith?view=net-8.0#system-collections-generic-iset-1-unionwith(system-collections-generic-ienumerable((-0))))