Table of Contents

Class SynchronizedQueue<T>

Namespace
Ecng.Collections
Assembly
Ecng.Collections.dll

Provides a thread-safe queue based on the QueueEx<T> collection.

public class SynchronizedQueue<T> : SynchronizedCollection<T, QueueEx<T>>, INotifyList<T>, INotifyCollection<T>, IList<T>, IList, ICollection, ISynchronizedCollection<T>, ISynchronizedCollection, ICollection<T>, IEnumerable<T>, IEnumerable

Type Parameters

T

The type of elements in the queue.

Inheritance
SynchronizedQueue<T>
Implements
Inherited Members
Extension Methods

Constructors

SynchronizedQueue()

Initializes a new instance of the SynchronizedQueue<T> class.

public SynchronizedQueue()

Methods

Dequeue()

Removes and returns the item at the beginning of the queue in a thread-safe manner.

public T Dequeue()

Returns

T

The item that was removed from the queue.

Enqueue(T)

Adds an item to the queue in a thread-safe manner.

public void Enqueue(T item)

Parameters

item T

The item to enqueue.

OnGetItem(int)

Throws a NotSupportedException as this operation is not supported for a queue.

protected override T OnGetItem(int index)

Parameters

index int

The index of the item to retrieve.

Returns

T

This method always throws an exception.

Exceptions

NotSupportedException

This operation is not supported for a queue.

OnIndexOf(T)

Throws a NotSupportedException as this operation is not supported for a queue.

protected override int OnIndexOf(T item)

Parameters

item T

The item to locate in the queue.

Returns

int

This method always throws an exception.

Exceptions

NotSupportedException

This operation is not supported for a queue.

OnInsert(int, T)

Throws a NotSupportedException as this operation is not supported for a queue.

protected override void OnInsert(int index, T item)

Parameters

index int

The index at which the item should be inserted.

item T

The item to insert.

Exceptions

NotSupportedException

This operation is not supported for a queue.

OnRemoveAt(int)

Throws a NotSupportedException as this operation is not supported for a queue.

protected override void OnRemoveAt(int index)

Parameters

index int

The index of the item to remove.

Exceptions

NotSupportedException

This operation is not supported for a queue.

Peek()

Returns the item at the beginning of the queue without removing it, in a thread-safe manner.

public T Peek()

Returns

T

The item at the beginning of the queue.