Edit

Share via


PooledResource<T> Class

Definition

Utility class to support pooled objects by allowing them to track the pool they came from and return to it when disposed

public abstract class PooledResource<T> : IDisposable where T : PooledResource<T>, IDisposable
type PooledResource<'T (requires 'T :> PooledResource<'T> and 'T :> IDisposable)> = class
    interface IDisposable
Public MustInherit Class PooledResource(Of T)
Implements IDisposable

Type Parameters

T
Inheritance
PooledResource<T>
Derived
Implements

Constructors

PooledResource<T>()

Properties

Pool

Gets the pool to return this resource to upon disposal. A pool must set this property upon resource allocation.

Methods

Dispose()

Returns item to pool.

OnResetState()

Notifies the object that it has been purged, so it can reset itself to the state of a newly allocated object.

SignalPurge()

If this object is to be used in a fixed size object pool, this call should be overridden with the purge implementation that returns the object to the pool.

Applies to