public override bool MoveNext() { int updatePosition = _position + (_reverse ? -1 : +1); if (updatePosition >= 0 && updatePosition < _collection.GetItems().Count) { _position = updatePosition; return(true); } return(false); }
public ConcreteIterator(ConcreteCollection collection, bool reverse) { _collection = collection; _reverse = reverse; if (_reverse) { this._position = _collection.GetItems().Count; } }