Ejemplo n.º 1
0
        /// <summary>
        /// 释放Csharp对象池组件;
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="type"></param>
        public void ReleaseCsharpObject <T>(T type) where T : new()
        {
            IPool target = type as IPool;

            if (target != null)
            {
                target.OnRelease();
            }
            CsharpObjectPool <T> pool;
            Object temp;

            if (_csharpObjectPool.TryGetValue(typeof(T), out temp))
            {
                pool = temp as CsharpObjectPool <T>;
            }
            else
            {
                pool = CreateCsharpPool <T>();
            }
            pool.Release(type);
        }