Is there some other way, except Stack<T>.Count() == 0
, to check if a Stack<T>
is empty?
Coming from C++/Java background where "stack" classes generally have some sort of dedicated "is empty" method like Java - Stack.empty.
Instead of using .Count() == 0
, just use .Count == 0
. This is using the stack's property rather than the linq extension method.