Class Pool<T>
- Namespace
- Gamelogic.Extensions
- Assembly
- Gamelogic.Extensions.dll
A light-weight pool class. Can be used out of the box, or as base for more sophisticated pools.
public class Pool<T> where T : class
Type Parameters
T
The type of the objects to pool.
- Inheritance
-
Pool<T>
- Inherited Members
- Extension Methods
Constructors
- Pool(int, Func<T>, Action<T>, Action<T>, Action<T>)
Initializes a new instance of the Pool<T> class.
Properties
- Capacity
The number total objects in the pool (awake and asleep).
- IsObjectAvailable
Returns whether there is a sleeping object available.
Methods
- DecCapacity(int)
Decreases the capacity of the pool.
- GetNewObject()
Gets a new object from the pool.
- IncCapacity(int)
Increases thew capacity of the pool.
- Release(T)
Releases the specified object back to the pool.