public static void Main(string[] args) { var linkedStack = new LinkedStack <int>(); linkedStack.Push(20); linkedStack.Push(2); linkedStack.Push(12); linkedStack.Push(5); var arr = linkedStack.ToArray(); Console.WriteLine(string.Join(", ", arr)); Console.WriteLine(linkedStack.Peek()); linkedStack.Pop(); var arr3 = linkedStack.ToArray(); Console.WriteLine(string.Join(", ", arr3)); }
static void Main(string[] args) { var stack = new LinkedStack <int>(); stack.Push(10); stack.Push(15); stack.Push(20); stack.Push(25); var arr = stack.ToArray(); foreach (var item in arr) { Console.WriteLine(item); } }
static void Main(string[] args) { LinkedStack <int> newStack = new LinkedStack <int>(); for (int i = 0; i < 100; i++) { newStack.Push(i); } int[] array = newStack.ToArray(); foreach (var i in array) { Console.WriteLine(i); } Console.WriteLine("Stack pop"); for (int i = 100; i >= 1; i--) { Console.WriteLine(newStack.Pop()); } }