using System.Collections.Generic; namespace YKMoon { public static class QueuePool { // Object pool to avoid allocations. private static readonly ObjectPool> pool = new ObjectPool>(null, q => q.Clear()); public static Queue Get() { return pool.Get(); } public static void Release(Queue toRelease) { pool.Release(toRelease); } } }