Exemple #1
0
        public T RemoveAtAndGet(int index)
        {
            if (index > this.Count)
            {
                throw new InvalidOperationException("Insufficient elements");
            }

            ListEntry <T> current  = _head;
            ListEntry <T> previous = null;

            for (int count = 0; count < index; count++)
            {
                previous = current;
                current  = current.Tail;
            }

            var deleted = current;

            previous.Extend(current.Tail);
            _count--;
            return(deleted.Element);
        }
Exemple #2
0
 public void Extend(ListEntry <T> tail)
 {
     _tail = tail;
 }
Exemple #3
0
 public ListEntry(Region region, T element)
 {
     _element = element;
     _tail    = null;
 }