Beispiel #1
0
 /// <summary>
 /// Push an item to the top of the stack
 /// </summary>
 /// <param name="value">item to put on the top of the stack</param>
 public void Push(T value)
 {
     if (IsFull())
     {
         throw new InvalidOperationException("Cannot push to full stack");
     }
     else if (IsEmpty())
     {
         Front = new SingleListNode <T>(value);
     }
     else
     {
         SingleListNode <T> next = new SingleListNode <T>(value);
         Front.Next = next;
         Front      = next;
     }
 }
 /// <summary>
 /// Sets the node value and next address
 /// </summary>
 /// <param name="value">Value of this node</param>
 /// <param name="next">Next node in sequence</param>
 public SingleListNode(T value, SingleListNode <T> next) :
     base(value)
 {
     Next = next;
 }