Example #1
0
        public override object Clone()
        {
            var clone   = new ListStack <T>();
            var current = _top;

            HandleRest();
            return(clone);

            void HandleRest()
            {
                if (current != null)
                {
                    var value = current.Value;
                    current = current.Next;
                    HandleRest();
                    clone.Push(value);
                }
            }
        }
Example #2
0
 public ListStackIterator(ListStack <T> stack)
 {
     _stack = stack;
     Reset();
 }