Put elements into a queue : Queue : Collections Data Structure C# Source Code


Custom Search

C# Source Code » Collections Data Structure » Queue »

 

Put elements into a queue








    
 

using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;

class Program {
    static void Main(string[] args) {
        Queue alphabet = new Queue();
        alphabet.Enqueue("A");
        alphabet.Enqueue("B");
        alphabet.Enqueue("C");

        Console.Write("First Iteration: ");

        foreach (string item in alphabet) {
            Console.Write(item);
        }

        Console.WriteLine("\nItem pulled from collection: " +
           alphabet.Dequeue().ToString());
        Console.Write("Second iteration: ");

        foreach (string item in alphabet) {
            Console.Write(item);
        }
    }
}

 
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Collections Data Structure
» Queue