Class FixedSizePool<T>
Inheritance
System.Object
FixedSizePool<T>
Assembly: Eco.Shared.dll
Syntax
public class FixedSizePool<T> : Object, IObjectPool<T> where T : class
Type Parameters
Constructors
FixedSizePool(Int32, Boolean, Func<T>)
Declaration
public FixedSizePool(int poolSize, bool preAllocate, Func<T> elementConstructor)
Parameters
| Type |
Name |
Description |
| System.Int32 |
poolSize |
|
| System.Boolean |
preAllocate |
|
| System.Func<T> |
elementConstructor |
|
Properties
CacheHitPercent
Declaration
public float CacheHitPercent { get; }
Property Value
| Type |
Description |
| System.Single |
|
Count
Declaration
public int Count { get; }
Property Value
| Type |
Description |
| System.Int32 |
|
PoolSize
Declaration
public int PoolSize { get; }
Property Value
| Type |
Description |
| System.Int32 |
|
Methods
Get()
Returns a object from the pool or null if no objects in the pool.
Declaration
Returns
| Type |
Description |
| T |
object from the pool or a new object.
|
TryAdd(T)
Tries to add object to the pool (if enough capacity in the pool).
Declaration
public bool TryAdd(T obj)
Parameters
| Type |
Name |
Description |
| T |
obj |
|
Returns
| Type |
Description |
| System.Boolean |
|
Implements
Extension Methods