예제 #1
0
        public void Push(T data)
        {
            var element = new SimpleStackElement <T>(data);

            element.Next = Head;
            Head         = element;
        }
예제 #2
0
        public T Pop()
        {
            if (Head == null)
            {
                throw new Exception("Стек пуст");
            }

            var returnElement = Head;

            Head = Head.Next;

            return(returnElement.Data);
        }
예제 #3
0
 public SimpleStack()
 {
     Head = null;
 }