Class ThreadUnsafePool<T>
Thread-unsafe lock free System.Collections.Generic.Stack<> based pool implementation. It implements IObjectPool<T> interface and has unlimited pool size.
You should prefer it to use over thread-safe pool implementations where you're sure it won't be used from multiple threads (in example in Unity components).
Inheritance
System.Object
ThreadUnsafePool<T>
Implements
System.Collections.Generic.IEnumerable<T>
System.Collections.IEnumerable
Assembly: Eco.Shared.dll
Syntax
public class ThreadUnsafePool<T> : Object, IObjectPool<T>, IEnumerable<T>, IEnumerable where T : class
Type Parameters
Constructors
ThreadUnsafePool()
Declaration
public ThreadUnsafePool()
Properties
Count
Declaration
public int Count { get; }
Property Value
Type |
Description |
System.Int32 |
|
Methods
CheckIsDuplicated(T)
Declaration
public void CheckIsDuplicated(T obj)
Parameters
Type |
Name |
Description |
T |
obj |
|
Get()
Declaration
Returns
GetEnumerator()
Declaration
public Stack<T>.Enumerator GetEnumerator()
Returns
Type |
Description |
System.Collections.Generic.Stack.Enumerator<> |
|
TryAdd(T)
Declaration
public bool TryAdd(T obj)
Parameters
Type |
Name |
Description |
T |
obj |
|
Returns
Type |
Description |
System.Boolean |
|
Implements
System.Collections.Generic.IEnumerable<>
System.Collections.IEnumerable
Extension Methods