Exemple #1
0
        // 清空
        public void Clear()
        {
            while (top != null)
            {
                LinkStackNode <T> node = top;
                top = top.next;
                node.Reset();
            }

            length = 0;
        }
Exemple #2
0
        // 出栈
        public T Pop()
        {
            if (length <= 0)
            {
                LogError("Out of the range!");
                return(default(T));
            }

            LinkStackNode <T> node = top;

            top = top.next;

            T data = node.data;

            node.Reset();
            length--;

            return(data);
        }