length Summary Returns the number of elements in the stack. Usage public property int length() Returns The number of elements in the stack. Description Returns the size of the stack, equivalent to the number of elements in the stack. Examples Basic Usage 1234567import System; auto stack1 = new Stack<int>();auto stack2 = new Stack<int>([ 1, 2, 3 ]); Console.log(stack1.length); // 0Console.log(stack2.length); // 3 Share HTML | BBCode | Direct Link