What is the Queue class?
Are you preparing for IT certification? With practice questions, study notes, interactive quizzes, tips and technical articles, uCertify PrepKits ensure that you get a solid grasp of core technical concepts to ace your certification exam in first attempt.
What is the Queue class?
Rating:
The Queue is a data structure that stores a object in such a manner that the object inserted first is the first to come out. The queue is also called first in first out (FIFO) list. The two important methods used in the queue class are as follows:
- Enqueue(): Inserts an object in the queue.
- Dequeue(): Removes an object from the queue.
using System;
using System.Collections;
public class SamplesQueue
{
public static void Main()
{
Queue MyQueue = new Queue();
MyQueue.Enqueue("Microsoft");
MyQueue.Enqueue("Corporation");
MyQueue.Enqueue("Limited");
PrintTheValues(myqueue);
}
public static void PrintTheValues(IEnumerable MyCollection)
{
foreach (Object list in MyCollection)
Console.Write(list);
}
}
Rating:
Was this information helpful?
Other articles
- How to format a document or a code file?
- What tasks are performed by a COM/DCOM server?
- What is the ICloneable interface?
- What is the IComparable interface?
- How to use the BufferedStream class?