clear Summary Clears the stack by removing all elements from the stack. Usage public void clear() Description Clears the stack by removing all elements from the stack. Examples Basic Usage 123456import System; auto stack = new Stack<int>([ 1, 2, 3 ]);Console.log(stack.length); // 3stack.clear();Console.log(stack.length); // 0 Share HTML | BBCode | Direct Link