Queue Concept in .Net

A collection that works on the First In First Out (FIFO) principle, i.e.,
the first item inserted is the first item removed from the collection.
Enqueue - To add element and Dequeue – To Remove element
Example:

static void Main()
{
Queue queue = new Queue();
queue.Enqueue(2);
queue.Enqueue(4);
queue.Enqueue(6);

while(queue.Count != 0)
{
Console.WriteLine(queue.Dequeue());
}
}


Output
2
4
6

1 comment:

Unknown said...

can u give the coding for stack and queue using arraylist in c#.net

Most Recent Post

Most Recent Ado.net FAQ

Most Recent .Net Framework FAQ

Most Recent Configuration Files FAQ

Daily Quote, Inspiration, Motivation and More

Subscribe Blog via Email

Enter your email address: