Class PooledStack<T>
Represents a variable size last-in-first-out (LIFO) collection of instances of the same specified type. Instances of this type are kept in a pool for recycling.
Inheritance
Namespace: System.Collections.Generic
Assembly: Nuqleon.Memory.dll
Syntax
public class PooledStack<T> : Stack<T>, IFreeable, IClearable
Type Parameters
| Name | Description |
|---|---|
| T | Specifies the type of elements in the stack. |
Methods
Free()
Frees the object and returns it to the pool.
Declaration
public void Free()
GetInstance()
Gets a System.Collections.Generic.Stack<> instance from the global stack pool.
Declaration
public static PooledStack<T> GetInstance()
Returns
| Type | Description |
|---|---|
| PooledStack<T> | A System.Collections.Generic.Stack<> instance obtained from the global pool. |
New()
Gets a pooled System.Collections.Generic.Stack<> instance, from the global pool, with RAII capabilities to return it to the pool.
Declaration
public static PooledStackHolder<T> New()
Returns
| Type | Description |
|---|---|
| PooledStackHolder<T> | Pooled stack instance. |
New(StackPool<T>)
Gets a pooled System.Collections.Generic.Stack<> instance, from the specified pool, with RAII capabilities to return it to the pool.
Declaration
public static PooledStackHolder<T> New(StackPool<T> pool)
Parameters
| Type | Name | Description |
|---|---|---|
| StackPool<T> | pool | Pool to allocate from. |
Returns
| Type | Description |
|---|---|
| PooledStackHolder<T> | Pooled stack instance. |
Exceptions
| Type | Condition |
|---|---|
| System.NullReferenceException | Thrown if |
Explicit Interface Implementations
IClearable.Clear()
Declaration
void IClearable.Clear()