示例#1
0
 public T Pop()
 {
     if (current != null)
     {
         T tmp = current.ValueOfElements;
         current = current.Next;
         return(tmp);
     }
     else
     {
         return(default);
示例#2
0
 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;
     }
 }