using System; using System.Collections.Generic; namespace XUtliPoolLib { public class HashPool { private static readonly ObjectPool> s_Pool = new ObjectPool>(new ObjectPool>.CreateObj(HashPool.Create), delegate(HashSet l) { l.Clear(); }, delegate(HashSet l) { l.Clear(); }); public static HashSet Create() { return new HashSet(); } public static HashSet Get() { return HashPool.s_Pool.Get(); } public static void Release(HashSet toRelease) { HashPool.s_Pool.Release(toRelease); } } }