ServicedComponent.CanBePooled Method

Definition

This method is called by the infrastructure before the object is put back into the pool. Override this method to vote on whether the object is put back into the pool.

C#
protected internal virtual bool CanBePooled();

Returns

true if the serviced component can be pooled; otherwise, false.

Examples

The following code example demonstrates the use of this method.

C#
// This object can be pooled.
protected override bool CanBePooled()
{
    return(true);
}

Applies to

Product Versions
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1