ConcurrentQueue<T>.GetEnumerator Method


Returns an enumerator that iterates through the ConcurrentQueue<T>.

 virtual System::Collections::Generic::IEnumerator<T> ^ GetEnumerator();
public System.Collections.Generic.IEnumerator<T> GetEnumerator ();
abstract member GetEnumerator : unit -> System.Collections.Generic.IEnumerator<'T>
override this.GetEnumerator : unit -> System.Collections.Generic.IEnumerator<'T>
Public Function GetEnumerator () As IEnumerator(Of T)


An enumerator for the contents of the ConcurrentQueue<T>.



The enumeration represents a moment-in-time snapshot of the contents of the queue. It does not reflect any updates to the collection after GetEnumerator was called. The enumerator is safe to use concurrently with reads from and writes to the queue.

The enumerator returns the collection elements in the order in which they were added, which is FIFO order (first-in, first-out).

Applies to

See also