コード例 #1
0
        public T Pop()
        {
            var popped = top;

            top = top._nextElement;
            ElemCount--;
            return(popped.data);
        }
コード例 #2
0
        public void Push(T obj)
        {
            var newElem = new StackElement <T>(obj)
            {
                _nextElement = this.top
            };

            this.top = newElem;
            ElemCount++;
        }