Class SimplePool<T>
Simple pool implementation.
Implements
Inherited Members
Namespace: Evergine.Framework.Helpers.Collections
Assembly: Evergine.Framework.dll
Syntax
public class SimplePool<T> : DisposableObject, IDisposable
Type Parameters
| Name | Description |
|---|---|
| T | The pool object type. |
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()
Destroy 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 remove. |
RetrieveItem()
Gets an item from the pool. Instantiate a new item is there are no items available.
Declaration
public T RetrieveItem()
Returns
| Type | Description |
|---|---|
| T | The item from the pool. |