/// <summary> /// Internal function to return objects to the pool. /// </summary> /// <param name="finished">The object to be returned.</param> internal override void returnObject(PooledObject finished) { if (stillAlive && (!MaxPoolSize.HasValue || pool.Count < MaxPoolSize)) { finished.callReset(); pool.Push((PooledType)finished); } else //Too many objects for pool or pool is disposed, cleanup object instead. { DestroyPooledObject((PooledType)finished); } }
/// <summary> /// Internal function to return objects to the pool. /// </summary> /// <param name="finished">The object to be returned.</param> internal override void returnObject(PooledObject finished) { finished.callReset(); pool.Push((PooledType)finished); }