private static void CustomerServiceQueue()
{
Queue CSQ = new Queue();
CSQ.Enqueue("Sid");
CSQ.Enqueue("Nad");
CSQ.Enqueue("Am");
CSQ.Enqueue("Sam");
Console.WriteLine("Peeking Queue: {0}", CSQ.Peek());
Console.WriteLine("Check if CSQ Contains Sid: {0}", CSQ.Contains("Sid"));
while (CSQ.Count > 0)
{
Console.WriteLine(CSQ.Dequeue());
}
}Contains checks for presence of the given object in the queue. Peek returns the first element from the queueDequeuue does the same as Peek, however, it also removes the object
No comments:
Post a Comment