Skip to content
David Cumps
Exam 70-536 study notes

Queue Class

Part of my 2008 study notes for exam 70-536 (.NET Framework 2.0).

Overview

  • First-in, first-out logic.
  • Works like a queue of customers in a bank.

Good practice

  • When possible, use the generic version, Queue<T>.

Examples

Queueing and Dequeuing

Queue q = new Queue();
q.Enqueue("Hello");
q.Enqueue("World");
Console.WriteLine(q.Dequeue() + " " + q.Dequeue());
 
Queue<string> qg = new Queue<string>();
qg.Enqueue("Hello");
qg.Enqueue("World");
Console.WriteLine(qg.Dequeue() + " " + qg.Dequeue());

You May Also Like