public T Pop() { if (current != null) { T tmp = current.ValueOfElements; current = current.Next; return(tmp); } else { return(default);
public void Push(T value) { if (current == null) { current = new StackElement <T> { ValueOfElements = value, Next = null }; } else { StackElement <T> tmp = new StackElement <T>() { ValueOfElements = value, Next = current }; current = tmp; } }