System.Data.SqlClient.SqlCachedStream.SetInternalPosition C# (CSharp) Method

SetInternalPosition() private method

private SetInternalPosition ( long lPos, string argumentName ) : void
lPos long
argumentName string
return void
        private void SetInternalPosition(long lPos, string argumentName)
        {
            long pos = lPos;

            if (pos < 0)
            {
                throw new ArgumentOutOfRangeException(argumentName);
            }
            for (int ii = 0; ii < _cachedBytes.Count; ii++)
            {
                if (pos > _cachedBytes[ii].Length)
                {
                    pos -= _cachedBytes[ii].Length;
                }
                else
                {
                    _currentArrayIndex = ii;
                    _currentPosition = (int)pos;
                    return;
                }
            }
            if (pos > 0)
                throw new ArgumentOutOfRangeException(argumentName);
        }