Class ObjectPool<T>
Object pool for reusing objects to avoid too many allocations.
Inheritance
System.Object
ObjectPool<T>
Namespace: SuperNet.Netcode.Util
Assembly: cs.temp.dll.dll
Syntax
public sealed class ObjectPool<T>
where T : class
Type Parameters
Name | Description |
---|---|
T | Object type. |
Constructors
ObjectPool(Int32)
Create a new object pool.
Declaration
public ObjectPool(int count)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | count | Number of objects this pool can hold. |
Methods
Rent()
Extract an object from this pool or return null.
Declaration
public T Rent()
Returns
Type | Description |
---|---|
T | Extracted object or null if none available. |
Return(T)
Return an object back to this pool.
Declaration
public void Return(T obj)
Parameters
Type | Name | Description |
---|---|---|
T | obj | Object to return. |