How do you clear a Stack<T>?
Use the Clear() method to remove all elements.
stack.Clear();
After this, Count becomes 0, and the internal array is reset.
Use the Clear() method to remove all elements.
stack.Clear();
After this, Count becomes 0, and the internal array is reset.