using System.Collections.Generic; using MemoryPools.Collections.Specialized; namespace MemoryPools.Collections.Linq { public static partial class PoolingEnumerable { public static IPoolingEnumerable Union(this IPoolingEnumerable source, IPoolingEnumerable second) { var set = Pool>.Get().Init(0); foreach (var item in source) set[item] = 1; foreach (var item in second) set[item] = 1; return Pool>.Get().Init(set); } public static IPoolingEnumerable Union(this IPoolingEnumerable source, IPoolingEnumerable second, IEqualityComparer comparer) { var set = Pool>.Get().Init(0, comparer); foreach (var item in source) set[item] = 1; foreach (var item in second) set[item] = 1; return Pool>.Get().Init(set); } } }