public T Pop() { if (first != null) { T temp = first.value; first = first.nextElement; return(temp); } else { throw new NullReferenceException(); } }
public void Push(T element) { if (first != null) { StackElement <T> temp = new StackElement <T>() { value = element, nextElement = first }; first = temp; } else { first = new StackElement <T>() { value = element, nextElement = null }; } }