Windows Phone Developers

Thursday, June 9, 2011

Queue in C# / Add and Remove items from Queue in C# (.NET)

Queues are common in real world - Flight checkins to School. Here is the way you can use it in C#

private static void CustomerServiceQueue()
            Queue CSQ = new Queue();


            Console.WriteLine("Peeking Queue: {0}", CSQ.Peek());

            Console.WriteLine("Check if CSQ Contains Beth : {0}", CSQ.Contains("Beth"));

            while (CSQ.Count > 0)


Contains checks for presence of the given object in the queue. Peek returns the first element from the queue

Dequeuue does the same as Peek, however, it also removes the object Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

No comments:

Post a Comment