SelfCreatingPool Class

public sealed class SelfCreatingPool<T> : ISelfCreatingNewObjectHandler<T> where T : class

A pool which is capable of generating new pooled objects when needed.

Constructors

SelfCreatingPool(Func<T>)

public SelfCreatingPool(Func<T> CreateNewObjectFunction)

Creates a new instance of the Self Creating Pool.

Parameters

Name Type Description
CreateNewObjectFunction Func<T>

The fuction to use to create new objects for the pool when needed.

Methods

DespositObject(T)

public void DespositObject(T obj)

Deposits an object back into the pool.

Parameters

Name Type Description
obj T

The object to deposit.


WithdrawObject()

public T WithdrawObject()

Withdraws an object from the pool.

Returns

T
The object.