Exemplo n.º 1
0
 public T pop()
 {
     if (current != null)
     {
         current = current.next;
         T tmp = current.value;
         return(tmp);
     }
     else
     {
         throw new NullReferenceException();
     }
 }
Exemplo n.º 2
0
 public void push(T elem)
 {
     if (current == null)
     {
         current = new NextVal <T>()
         {
             value = elem, next = null
         };
     }
     else
     {
         NextVal <T> temp = new NextVal <T>()
         {
             value = elem, next = current
         };
         current = temp;
     }
 }