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()); } }
Output2 4 6
No comments:
Post a Comment