← Interactive API Explorer
Namespace: System.Collections.Concurrent

ConcurrentQueue<T>

Represents a thread-safe first in-first out (FIFO) collection.

Properties (2)

int Count
Gets the number of elements contained in the ConcurrentQueue.
Value: The number of elements contained in the ConcurrentQueue.
bool IsEmpty
Gets a value that indicates whether the ConcurrentQueue is empty.
Value: true if the ConcurrentQueue is empty; otherwise, false.

Methods (2)

void Enqueue(T)
Adds an object to the end of the ConcurrentQueue.
ParameterDescription
itemThe object to add to the end of the ConcurrentQueue. The value can be a null reference (Nothing in Visual Basic) for reference types.
bool TryDequeue(T@)
Tries to remove and return the object at the beginning of the concurrent queue.
ParameterDescription
resultWhen this method returns, if the operation was successful, result contains the object removed. If no object was available to be removed, the value is unspecified.
Returns: true if an element was removed and returned from the beginning of the ConcurrentQueue successfully; otherwise, false.