// The Pool class iscontrols theaccess mostto importantthe classpooled inobjects. theIt objectmaintains poola designlist pattern.of Itavailable controlsobjects accessand toa the
// pooledcollection of objects,maintainingthat ahave listbeen ofobtained availablefrom objectsthe pool and aare collectionin ofuse. objectsThe pool ensures that havereleased alreadyobjects been
// are returned to a suitable state, ready for the next time they are requestedreuse. ▼
// requested from the pool and are still in use. The pool also ensures that objects that have been released
▲ // are returned to a suitable state, ready for the next time they are requested.
public static class Pool
{
Line 244 ⟶ 243:
}
</syntaxhighlight>
In the code above, the PooledObject has properties for the time it was created, and another, that can be modified by the client, that is reset when the PooledObject is released back to the pool. Shown is the clean-up process, on release of an object, ensuring it is in a valid state before it can be requested from the pool again.
In the code above, the PooledObject includes two properties. One holds
the time at which the object was first created. The other holds a string that can be modified by the client
but that is reset when the PooledObject is released back to the pool. This shows the clean-up process on release
of an object that ensures it is in a valid state before it can be requested from the pool again.