Example #1
0
 public IImmutableStack<T> Pop()
 {
     var newList = new LinkedList<T>(_list);
     newList.RemoveLast();
     return new Stack<T>(newList);
 }
Example #2
0
 public IImmutableStack<T> Push(T value)
 {
     var newList = new LinkedList<T>(_list) {value};
     return new Stack<T>(newList);
 }
Example #3
0
 private Stack(LinkedList<T> list)
 {
     _list = list;
 }