using System; namespace XUtliPoolLib { public class CommonObjectPool where T : new() { private static readonly ObjectPool s_Pool = new ObjectPool(new ObjectPool.CreateObj(CommonObjectPool.Create), null, null); public static object Create() { return Activator.CreateInstance(); } public static T Get() { return (T)((object)CommonObjectPool.s_Pool.Get()); } public static void Release(T toRelease) { CommonObjectPool.s_Pool.Release(toRelease); } } }