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