DefaultObjectPool<T> Class

Definition

Default implementation of ObjectPool<T>.

C#
public class DefaultObjectPool<T> : Microsoft.Extensions.ObjectPool.ObjectPool<T> where T : class

Type Parameters

T

The type to pool objects for.

Inheritance
DefaultObjectPool<T>

Remarks

This implementation keeps a cache of retained objects. This means that if objects are returned when the pool has already reached "maximumRetained" objects they will be available to be Garbage Collected.

Constructors

Methods

Get()

Gets an object from the pool if one is available, otherwise creates one.

Return(T)

Return an object to the pool.

Applies to

Product Versions
.NET 10 (package-provided)
.NET Standard 2.0 (package-provided)