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