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