Пример #1
0
        private static ObjectPool <T> getInstance()
        {
            var m = new ObjectPool <T>();

            PoolHelper.Add(m);
            return(m);
        }
Пример #2
0
        private static ObjectPool <List <T> > getInstance()
        {
            var m = new ObjectPool <List <T> >(null, l =>
            {
                var isReference = PoolHelper.IsReferenceType(typeof(T));
                var a           = l.Count;
                for (int i = 0; i < a; i++)
                {
                    if (isReference)
                    {
                        l[i] = default(T);
                    }
                }
                l.Clear();
            });

            PoolHelper.Add(m);
            return(m);
        }