Queue : Queue, indicating the object's first-in-first-out set. The enqueue method is used to enter the queue, and the dequeue method is used to output the queue. Using System;
Using System. Collections. Generic;
Using System. text;
Using System. collections;
Namespace Leleapplication1
{
Class Program
{
Static Void Main ( String [] ARGs)
{
Queue Qu = New Queue ();
Queue qu2 = New Queue ();
Foreach ( Int I In New Int [ 4 ] {1,2,3,4} )
{
Qu. enqueue (I );//Join
Qu2.enqueue (I );
}
Foreach ( Int I In Qu)
{
Console. writeline (I );//Traversal
}
Qu. dequeue (); // Team-out
Console. writeline ( " Dequeue " );
Foreach ( Int I In Qu)
{
Console. writeline (I );
}
Qu2.peek (); // Returns the object at the beginning of the queue, but does not remove it.
Console. writeline ( " Peek " );
Foreach ( Int I In Qu2)
{
Console. writeline (I );
}
}
}
}