Table of Contents

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

queue Queue<T>

The queue.

Returns

IEnumerable<T>

The dequeued elements in the order they were dequeued.

Type Parameters

T

The 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

queue Queue<T>

The queue.

count int

The number of elements to dequeue.

Returns

IEnumerable<T>

The dequeued elements in the order they were dequeued.

Type Parameters

T

The 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

queue Queue<T>

The queue.

range IEnumerable<T>

The elements to enqueue.

Type Parameters

T

The 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

queue Queue<T>

The queue.

item T

The item to insert into the queue.

index int

The index at which the item will be inserted.

Type Parameters

T

The 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.