示例#1
0
        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");
        }
示例#2
0
 public void Reset()
 {
     _current = null;
     _status  = DoublyLinkedListEnumeratorStatus.New;
 }