Class SimplePool<T>
Simple pool implementation.
Inherited Members
Namespace: Evergine.Framework.Helpers.Collections
Assembly: Evergine.Framework.dll
Syntax
public class SimplePool<T> : DisposableObject
Type Parameters
Name | Description |
---|---|
T | The type of object in the pool. |
Constructors
SimplePool(Func<T>)
Initializes a new instance of the SimplePool<T> class.
Declaration
public SimplePool(Func<T> allocator)
Parameters
Type | Name | Description |
---|---|---|
Func<T> | allocator | The allocator function. |
Methods
Destroy()
Destroys all resources of this instance.
Declaration
protected override void Destroy()
Overrides
ReleaseItem(T)
Releases an item from the pool.
Declaration
public void ReleaseItem(T item)
Parameters
Type | Name | Description |
---|---|---|
T | item | The item to be released. |
RetrieveItem()
Gets an item from the pool. Instantiates a new item if there are no items available.
Declaration
public T RetrieveItem()
Returns
Type | Description |
---|---|
T | The item from the pool. |