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); }
public void Extend(ListEntry <T> tail) { _tail = tail; }
public ListEntry(Region region, T element) { _element = element; _tail = null; }