Junior Collections

What is a Queue<T> in C#?

A Queue<T> is a generic collection in C# that stores elements in a First-In, First-Out

(FIFO) order.

  • The first item added is the first to be removed.
  • It is part of the System.Collections.Generic namespace.

Use case:

Modeling real-world queues — e.g., print jobs, task scheduling, or customer service

systems.

Example:

Queue<string> orders = new Queue<string>();

orders.Enqueue("Order1");

orders.Enqueue("Order2");

More from C# Programming Tutorial

All questions for this course