public void Push(T data) { StackNode <T> addedNode = new StackNode <T>(data); if (headNode == null) { headNode = addedNode; } else { addedNode.next = headNode; headNode = addedNode; } Length++; }
public void Push(T value) { if (Top == null) { Top = new StackNode <T>(value); } else { var newTop = new StackNode <T>(value); newTop.Next = Top; Top = newTop; Top.Value = value; } Count++; }
public object Pop() { lock (this) { if (IsEmpty()) { throw new Exception(); } object popItem = top.Data; if (top == last) { top = last = null; } else { top = top.Next; } return(popItem); } }
public StackNode(object dataValue, StackNode nextValue) { data = dataValue; next = nextValue; }
public void Clear() { count = 0; top = null; }
public StackNode(T data) { this.data = data; next = null; }
public Stack() { headNode = null; }
public void Clear() { Top = null; }
public Stack(T Value) { Top = new StackNode <T>(Value); Count++; }