Exemplo n.º 1
0
        public T Pop()
        {
            StackElement <T> temp = startElement;

            if (startElement == null)
            {
                throw new NullReferenceException();
            }
            else
            {
                startElement = startElement.next;
                return(temp.value);
            }
        }
Exemplo n.º 2
0
 public MyStack()
 {
     startElement = null;
 }
Exemplo n.º 3
0
        public void Push(T value)
        {
            StackElement <T> element = new StackElement <T>(value, startElement);

            startElement = element;
        }
Exemplo n.º 4
0
 public StackElement(T value, StackElement <T> next)
 {
     this.value = value;
     this.next  = next;
 }