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