public static void Main() { var testQueue = new MyQueue <string>(); testQueue.Enqueue("One"); testQueue.Enqueue("Two"); testQueue.Enqueue("Four"); Console.WriteLine(testQueue); Console.WriteLine("Removing: {0}", testQueue.Dequeue()); ////Console.WriteLine("Removing: {0}", testQueue.Dequeue()); Console.WriteLine(testQueue.Peek()); Console.WriteLine(testQueue); }
public static void Main() { MyQueue testQueue = new MyQueue(); testQueue.Enqueue("some item"); testQueue.Enqueue(1); testQueue.Enqueue(1.24); Console.WriteLine(testQueue); var element = testQueue.Dequeue(); while (element != null) { Console.WriteLine(element); element = testQueue.Dequeue(); } }
public static void Main() { var stack = new MyQueue<int>(); stack.Enqueue(1); stack.Enqueue(2); stack.Enqueue(3); stack.Enqueue(4); stack.Enqueue(5); stack.Enqueue(6); stack.Enqueue(7); Console.WriteLine(string.Join(", ", stack)); stack.Dequeue(); stack.Dequeue(); stack.Dequeue(); stack.Dequeue(); stack.Enqueue(7); stack.Dequeue(); stack.Enqueue(7); Console.WriteLine(string.Join(", ", stack)); }