public bool MoveNext() { switch (_status) { case DoublyLinkedListEnumeratorStatus.New: { _current = _first; _status = GetStatusAfterMovingNext(_current); return(_status == DoublyLinkedListEnumeratorStatus.HasValue); } case DoublyLinkedListEnumeratorStatus.HasValue: { _current = _current.Next; _status = GetStatusAfterMovingNext(_current); return(_status == DoublyLinkedListEnumeratorStatus.HasValue); } case DoublyLinkedListEnumeratorStatus.ReachedTheEnd: return(false); } throw new InvalidOperationException("Unknown status"); }
public void Reset() { _current = null; _status = DoublyLinkedListEnumeratorStatus.New; }