public T Pop() { var popped = top; top = top._nextElement; ElemCount--; return(popped.data); }
public void Push(T obj) { var newElem = new StackElement <T>(obj) { _nextElement = this.top }; this.top = newElem; ElemCount++; }