Working with Queues in .NET Part 2 – Dequeue and peek at elements

Now it’s time to read from our queue.

Console.WriteLine("Dequeing oldest element in the queue: {0} ", numbers.Dequeue());

Time to run the app!

Great! Now add a peek to the queue and run the app again.

Console.WriteLine("Peeking at the now oldest item in the queue {0}", numbers.Peek());

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: