Пример #1
0
 private void SetIndex(int index, bool allowCurrent)
 {
     if (index < 0 || index >= NumFields)
     {
         throw new IndexOutOfRangeException();
     }
     if ((!allowCurrent || _reader.CurrentlyStreaming) ? index <= _lastIndex : index < _lastIndex)
     {
         throw new InvalidOperationException(
                   string.Format(resman.GetString("Row_Sequential_Field_Error"), index, _lastIndex + 1));
     }
     _reader.Skip(index - _lastIndex - 1);
     _lastIndex = index;
 }
Пример #2
0
        private void Seek(int index, bool consume)
        {
            if (index < 0 || index >= NumFields)
            {
                throw new IndexOutOfRangeException();
            }

            var d = index - _i;

            if (d < 0)
            {
                throw new InvalidOperationException(string.Format(L10N.RowSequentialFieldError, index, _i));
            }
            if (d > 0)
            {
                _reader.Skip(d);
                _i += d;
            }
            if (consume)
            {
                _i++;
            }
        }