Struct ObjectPool<T>.PooledObject
A Pooled object wraps a reference to an instance that will be returned to the pool when the Pooled object is disposed. The purpose is to automate the return of references so that they do not need to be returned manually. A PooledObject can be used like so:
MyClass myInstance;
using(myPool.Get(out myInstance)) // When leaving the scope myInstance will be returned to the pool.
{
// Do something with myInstance
}
Inherited Members
System.ValueType.ToString()
System.Object.Equals(System.Object, System.Object)
System.Object.GetType()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: StansAssets.Foundation.Patterns
Assembly: cs.temp.dll.dll
Syntax
public readonly struct PooledObject : IDisposable, IEquatable<ObjectPool<T>.PooledObject>
Constructors
PooledObject(T, ObjectPool<T>)
Creates IDisposable
wrapper around poolable object.
Declaration
public PooledObject(T value, ObjectPool<T> pool)
Parameters
Type | Name | Description |
---|---|---|
T | value | |
ObjectPool<T> | pool |
Methods
Equals(ObjectPool<T>.PooledObject)
Declaration
public readonly bool Equals(ObjectPool<T>.PooledObject other)
Parameters
Type | Name | Description |
---|---|---|
ObjectPool.PooledObject<> | other |
Returns
Type | Description |
---|---|
System.Boolean |
Equals(Object)
Declaration
public override readonly bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
System.Object | obj |
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
System.ValueType.Equals(System.Object)
GetHashCode()
Declaration
public override readonly int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 |
Overrides
System.ValueType.GetHashCode()
Explicit Interface Implementations
IDisposable.Dispose()
Declaration
readonly void IDisposable.Dispose()
Implements
System.IDisposable
System.IEquatable<T>