Class QueueExtensions
- Namespace
- Garyon.Extensions
- Assembly
- Garyon.dll
Provides extensions for the Queue<T> class.
public static class QueueExtensions
- Inheritance
-
QueueExtensions
- Inherited Members
Methods
DequeueAll<T>(Queue<T>)
Dequeues all elements from the queue.
public static IEnumerable<T> DequeueAll<T>(this Queue<T> queue)
Parameters
queueQueue<T>The queue.
Returns
- IEnumerable<T>
The dequeued elements in the order they were dequeued.
Type Parameters
TThe type of the elements contained in the queue.
DequeueRange<T>(Queue<T>, int)
Dequeues a range of elements from the queue.
public static IEnumerable<T> DequeueRange<T>(this Queue<T> queue, int count)
Parameters
Returns
- IEnumerable<T>
The dequeued elements in the order they were dequeued.
Type Parameters
TThe type of the elements contained in the queue.
EnqueueRange<T>(Queue<T>, IEnumerable<T>)
Enqueues a range of elements to the queue.
public static void EnqueueRange<T>(this Queue<T> queue, IEnumerable<T> range)
Parameters
queueQueue<T>The queue.
rangeIEnumerable<T>The elements to enqueue.
Type Parameters
TThe type of the elements contained in the queue.
Insert<T>(Queue<T>, T, int)
Inserts an element in the queue at the specified index.
public static void Insert<T>(this Queue<T> queue, T item, int index)
Parameters
queueQueue<T>The queue.
itemTThe item to insert into the queue.
indexintThe index at which the item will be inserted.
Type Parameters
TThe type of the values stored in the queue.
Remarks
This is an expensive operation, due to the lack of the necessary public APIs for speeding up the insertion.