Queue<T>.TryDequeue(T) Method

Definition

Removes the object at the beginning of the Queue<T>, and copies it to the result parameter.

C#
public bool TryDequeue(out T result);

Parameters

result
T

The removed object.

Returns

true if the object is successfully removed; false if the Queue<T> is empty.

Applies to

Product Versions
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Standard 2.1