Queue.Dequeue() : Queue « System.Collections « C# / C Sharp by API






Queue.Dequeue()

  
 
using System; 
using System.Collections; 
  
class MainClass { 
 
  public static void Main() { 
    Queue q = new Queue(); 
 
    q.Enqueue(1); 
    q.Enqueue(2); 
    q.Enqueue(3); 
    q.Enqueue(4); 
 
    Console.Write("queue: "); 
    foreach(int i in q) 
      Console.Write(i + " "); 
 
    Console.WriteLine();         

    Console.Write("Dequeue -> "); 
    int a = (int) q.Dequeue(); 
    Console.WriteLine(a); 
 
    Console.Write("queue: "); 
    foreach(int i in q) 
      Console.Write(i + " "); 
 
    Console.WriteLine();         
 
  } 
}

   
    
  








Related examples in the same category

1.Queue.Clear()
2.Queue.Peek()