Thursday 22 March 2012

Generic Queue


//Generic Queue demonstration
using System;
using System.Collections.Generic;

class Program
{
static void Main()
{
Queue<int> queueObj=new Queue<int>();

queueObj.Enqueue(20);
queueObj.Enqueue(30);
queueObj.Enqueue(50);
queueObj.Enqueue(40);
queueObj.Enqueue(60);
queueObj.Enqueue(80);

for(int i=0;i<queueObj.Count;i=i+0)
{
Console.WriteLine(queueObj.Dequeue());
}
}
}

No comments:

Post a Comment