Table of Contents

Class DefaultObjectPool<T>

Namespace
Backdash.Data
Assembly
Backdash.dll

Default object pool for types with empty constructor

public sealed class DefaultObjectPool<T> : IObjectPool<T> where T : class, new()

Type Parameters

T
Inheritance
DefaultObjectPool<T>
Implements
Inherited Members

Constructors

DefaultObjectPool(int, IEqualityComparer<T>?)

Instantiate new DefaultObjectPool<T>

public DefaultObjectPool(int capacity = 100, IEqualityComparer<T>? comparer = null)

Parameters

capacity int
comparer IEqualityComparer<T>

Fields

Instance

Default object pool singleton.

public static readonly IObjectPool<T> Instance

Field Value

IObjectPool<T>

MaxCapacity

Maximum number of objects allowed in the pool

public readonly int MaxCapacity

Field Value

int

Properties

Count

Number of instances in the object pool

public int Count { get; }

Property Value

int

Methods

Clear()

Clear the object pool

public void Clear()

Rent()

Rent an instance on T from the pool

public T Rent()

Returns

T

Return(T)

Return value to the pool

public void Return(T value)

Parameters

value T