using System.Collections.Generic; namespace XCharts.Runtime { internal static class ListPool { private static readonly ObjectPool> s_ListPool = new ObjectPool>(OnGet, OnClear); static void OnGet(List l) { if (l.Capacity < 50) { l.Capacity = 50; } } static void OnClear(List l) { l.Clear(); } public static List Get() { return s_ListPool.Get(); } public static void Release(List toRelease) { s_ListPool.Release(toRelease); } public static void ClearAll() { s_ListPool.ClearAll(); } } }