Пример #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;
     }
 }