Class ObjectPool<T>
Object pool collection.
Inherited Members
Namespace: Evergine.Common.Helpers
Assembly: Evergine.Common.dll
Syntax
public class ObjectPool<T>
Type Parameters
Name | Description |
---|---|
T | The pool object type. |
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()
Clear the pooled objects.
Declaration
public void Clear()
Get()
Get a pooled object.
Declaration
public T Get()
Returns
Type | Description |
---|---|
T | A pooled object. |
Return(T)
Return a pooled object.
Declaration
public void Return(T element)
Parameters
Type | Name | Description |
---|---|---|
T | element | The object to release. |