using System; using System.Collections.Generic; using System.Text; namespace Thousandto.Core.Base { public class PooledObjectWrapper : PooledObject { public MyAction WrapperReleaseResourcesAction { get; set; } public MyAction WrapperResetStateAction { get; set; } public T InternalResource { get; private set; } public PooledObjectWrapper(T resource) { if (resource == null) { throw new ArgumentException("resource cannot be null"); } // Setting the internal resource InternalResource = resource; } protected override void OnReleaseResources() { if (WrapperReleaseResourcesAction != null) { WrapperReleaseResourcesAction(InternalResource); } } protected override void OnResetState() { if (WrapperResetStateAction != null) { WrapperResetStateAction(InternalResource); } } } }