public abstract class Pool

Abstract class for object poolingThe type to pool

Fields

public readonly int MaximumCapacity

The maximum amount of objects, active or inactive


Properties

public int CreatedAmount { get; private set; }

How many objects have been created


public int AmountInUse

No description provided


Methods

public (constructor) Pool(int maxCapacity = 1000)

Create a pool with the given capacity


public virtual T RequestObject()

Get an object from the pool. This will be ready for use or null, if the pool is at full capacity.


public virtual void ReturnToPool(T obj)

Return an object to the pool when it's done, to allow it to be requested again


public virtual void Prefill()

Create a new available object and add it to the pool, waiting to be used


protected virtual T GetExistingFromPool()

Get an existing object from the pool guaranteeing never to create a new one. Can return null.


protected abstract T CreateFresh()

Return a completely new instance of the poolable object


protected abstract void ResetObjectForNextUse(T obj)

Reset the given object for its next use


protected abstract T GetOverCapacityFallback()

What to return instead of null when the pool is at full capacity


Attention!

This member is obsolete and should not be used. It is a remnant from the past.

bi bij bibi