Class PooledObject
- Namespace
- CodeProject.ObjectPool
- Assembly
- CodeProject.ObjectPool.dll
PooledObject base class.
[Serializable]
public abstract class PooledObject : IDisposable, IEquatable<PooledObject>
- Inheritance
-
PooledObject
- Implements
- Derived
- Inherited Members
Properties
OnReleaseResources
Releases the object's resources.
public Action? OnReleaseResources { get; set; }
Property Value
OnResetState
Reset the object state to allow this object to be re-used by other parts of the application. If reset cannot be successfully performed, delegates can throw ResetStateFailureException in order to let the pool know that the object should be released.
public Action? OnResetState { get; set; }
Property Value
OnValidateObject
Validates pooled object state. An invalid object will not get into the pool and it will not be returned to consumers.
public Func<PooledObjectValidationContext, bool>? OnValidateObject { get; set; }
Property Value
PooledObjectInfo
Core information about this PooledObject.
public PooledObjectInfo PooledObjectInfo { get; }
Property Value
Methods
Dispose()
See IDisposable docs.
public void Dispose()
Equals(PooledObject?)
Indicates whether the current object is equal to another object of the same type.
public virtual bool Equals(PooledObject? other)
Parameters
other
PooledObjectAn object to compare with this object.
Returns
- bool
true if the current object is equal to the
other
parameter; otherwise, false.
Equals(object?)
Determines whether the specified object is equal to the current PooledObject.
public override bool Equals(object? obj)
Parameters
obj
objectThe object to compare with the current PooledObject.
Returns
- bool
true if the specified object is equal to the current PooledObject; otherwise, false.
~PooledObject()
PooledObject destructor.
protected ~PooledObject()
GetHashCode()
Serves as a hash function for a particular type.
public override int GetHashCode()
Returns
- int
A hash code for the current PooledObject.
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
Operators
operator ==(PooledObject?, PooledObject?)
Compares to pooled objects.
public static bool operator ==(PooledObject? left, PooledObject? right)
Parameters
left
PooledObjectLeft object.
right
PooledObjectRight object.
Returns
- bool
True if given pooled objects are equal, false otherwise.
operator !=(PooledObject?, PooledObject?)
Compares to pooled objects.
public static bool operator !=(PooledObject? left, PooledObject? right)
Parameters
left
PooledObjectLeft object.
right
PooledObjectRight object.
Returns
- bool
True if given pooled objects are not equal, false otherwise.