New to Telerik UI for WPFStart a free 30-day trial

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:

C#
public class ObjectPool

Inheritance: objectObjectPool

Constructors

C#
public ObjectPool()

Methods

Clears the object pool associated with the specified PoolId.

C#
public void ClearPool(ObjectPool.PoolId poolId)
Parameters:poolIdObjectPool.PoolId

The identifier of the pool to be cleared.

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

C#
public T CreateObject<T>() where T : new()
Returns:

T

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

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

C#
public T CreateObject<T>(ObjectPool.PoolId poolID) where T : new()
Parameters:poolIDObjectPool.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.

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

C#
public void ReleaseObject(object obj, ObjectPool.PoolId poolID)
Parameters:objobject

The object to be released.

poolIDObjectPool.PoolId

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

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

C#
public void ReleaseObject(object obj)
Parameters:objobject

The object to release to the pool.