C# Queue Dequeue
Description
Queue Dequeue
removes and returns the object at the beginning
of the Queue.
Syntax
Queue.Dequeue
has the following syntax.
public virtual Object Dequeue()
Returns
Queue.Dequeue
method returns The object that is removed from the beginning of the Queue.
Example
The following example shows how to add elements to the Queue, remove elements from the Queue.
using System;//from w w w . j ava2 s. c o m
using System.Collections;
public class SamplesQueue {
public static void Main() {
Queue myQ = new Queue();
myQ.Enqueue( "A" );
myQ.Enqueue( "B" );
myQ.Enqueue( "C" );
myQ.Enqueue( "D" );
Console.WriteLine(myQ.Dequeue() );
}
}
The code above generates the following result.