private static void PrintValues(Stack stack) { var list = stack.ViewStack().ToArray().Reverse(); Console.WriteLine("-----Stack-----"); foreach (var x in list) { Console.WriteLine(x); } Console.WriteLine("---------------"); }