Class ObjectPool<T>
Object pool collection.
Namespace: Evergine.Common.Helpers
Assembly: Evergine.Common.dll
Syntax
public class ObjectPool<T>
Type Parameters
| Name | Description |
|---|---|
| T | The type of objects in the pool. |
Constructors
ObjectPool(IPooledObjectPolicy<T>)
Initializes a new instance of the ObjectPool<T> class.
Declaration
public ObjectPool(IPooledObjectPolicy<T> policy)
Parameters
| Type | Name | Description |
|---|---|---|
| IPooledObjectPolicy<T> | policy | The object policy. |
Properties
Size
Gets the pool size.
Declaration
public int Size { get; }
Property Value
| Type | Description |
|---|---|
| int |
Methods
Clear()
Clears the pooled objects.
Declaration
public void Clear()
Get()
Gets a pooled object.
Declaration
public T Get()
Returns
| Type | Description |
|---|---|
| T | A pooled object. |
Return(T)
Returns a pooled object.
Declaration
public void Return(T element)
Parameters
| Type | Name | Description |
|---|---|---|
| T | element | The object to release. |