queue definition with example in C#.Net

Queue is nothing but First in first out. Queue is dotnet framework class, we can use like below. Here we are creating an object for th Queue.

Queue<int> obj=new Queue<int>;

points to remember:
1. we can copy queue data into an array.
2. we can use this queue in the call center simulation process for first come first server basis.


Example: 

    static void Main()
    {
 // Creating object for integer queues
 Queue<int> objQueue = new Queue<int>();

 objQueue.Enqueue(10);   // Adding 5 .
 objQueue.Enqueue(20);  // Then add 10
 objQueue.Enqueue(30);  // Then add 15.
 objQueue.Enqueue(40);  // Then add 20.
    }


Share this post :

Post a Comment

Please give your valuable feedback on this post. You can submit any ASP.NET article here. We will post that article in this website by your name.

 
Support : Ranga Rajesh Kumar
Copyright © 2012. ASP.NET Examples - All Rights Reserved
Site Designed by Ranga Rajesh Kumar