Partager via


Queue Collection Types 

The Queue class and the Queue generic class are first-in-first-out collection classes that implement the ICollection interface and the ICollection generic interface.

The Queue and Stack classes, and the Queue and Stack generic classes are useful when you need temporary storage for information, that is, when you might want to discard an element after retrieving its value. Use Queue if you need to access the information in the same order that it is stored in the collection. Use Stack if you need to access the information in reverse order.

Three main operations can be performed on a Queue and its elements:

  • Enqueue adds an element to the end of the Queue.

  • Dequeue removes the oldest element from the start of the Queue.

  • Peek returns the oldest element from the start of the Queue but does not remove it from the Queue.

See Also

Reference

Queue
System.Collections.Generic.Queue
Stack
System.Collections.Generic.Stack
ICollection
System.Collections.Generic.ICollection

Other Resources

Commonly Used Collection Types