Class QueuePool<T>
Defines a system used to store and retrieve Queue<T> objects.
public class QueuePool<T> : IPool<Queue<T>>
Type Parameters
T
The type of the objects in the list.
- Inheritance
-
QueuePool<T>
- Implements
- Inherited Members
- Extension Methods
Properties
Pool
Gets a QueuePool<T> that stores lists.
public static QueuePool<T> Pool { get; }
Property Value
- QueuePool<T>
Methods
Get()
Retrieves a stored object of type System.Collections.Generic.Queue{`0}, or creates it if it does not exist.
public Queue<T> Get()
Returns
- Queue<T>
The stored object, or a new object, of type System.Collections.Generic.Queue{`0}.
Get(IEnumerable<T>)
Retrieves a stored object of type List<T>, or creates it if it does not exist. The list will be filled with all the provided items
.
public Queue<T> Get(IEnumerable<T> items)
Parameters
items
IEnumerable<T>The items to fill the list with.
Returns
Return(Queue<T>)
Returns the object to the pool.
public void Return(Queue<T> obj)
Parameters
obj
Queue<T>The object to return, of type System.Collections.Generic.Queue{`0}.
ToArrayReturn(Queue<T>)
Returns the Queue<T> to the pool and returns its contents as an array.
public T[] ToArrayReturn(Queue<T> obj)
Parameters
Returns
- T[]
The contents of the returned queue as an array.
See Also
DictionaryPool<TKey, TValue>
HashSetPool<T>