Class
ObjectPool

Represents a pool of reusable objects to optimize memory usage and improve performance by minimizing the cost of object creation and destruction.

Definition

Namespace:Telerik.Windows.Documents.UI

Assembly:Telerik.Windows.Controls.RichTextBox.dll

Syntax:

cs-api-definition
public class ObjectPool

Inheritance: objectObjectPool

Constructors

ObjectPool()

Declaration

cs-api-definition
public ObjectPool()

Methods

ClearPool(PoolId)

Clears the object pool associated with the specified PoolId.

Declaration

cs-api-definition
public void ClearPool(ObjectPool.PoolId poolId)

Parameters

poolId

ObjectPool.PoolId

The identifier of the pool to be cleared.

CreateObject<T>()

Creates an instance of the specified type T from the object pool.

Declaration

cs-api-definition
public T CreateObject<T>() where T : new()

Returns

T

An instance of the specified type T from the object pool.

CreateObject<T>(PoolId)

Creates an object of the specified type from the object pool identified by the given PoolId.

Declaration

cs-api-definition
public T CreateObject<T>(ObjectPool.PoolId poolID) where T : new()

Parameters

poolID

ObjectPool.PoolId

The identifier of the object pool from which to create the object.

Returns

T

A new instance of the specified type T retrieved from the object pool.

ReleaseObject(object)

Releases the specified object back to the object pool for reuse.

Declaration

cs-api-definition
public void ReleaseObject(object obj)

Parameters

obj

object

The object to release to the pool.

ReleaseObject(object, PoolId)

Releases an object back to the specified object pool for reuse.

Declaration

cs-api-definition
public void ReleaseObject(object obj, ObjectPool.PoolId poolID)

Parameters

obj

object

The object to be released.

poolID

ObjectPool.PoolId

The identifier of the object pool to which the object is being released.