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