System.Data.Common.ADP.InvalidBufferSizeOrIndex C# (CSharp) Méthode

InvalidBufferSizeOrIndex() static private méthode

static private InvalidBufferSizeOrIndex ( int numBytes, int bufferIndex ) : IndexOutOfRangeException
numBytes int
bufferIndex int
Résultat System.IndexOutOfRangeException
        static internal IndexOutOfRangeException InvalidBufferSizeOrIndex(int numBytes, int bufferIndex)
        {
            return IndexOutOfRange(Res.GetString(Res.SQL_InvalidBufferSizeOrIndex, numBytes.ToString(CultureInfo.InvariantCulture), bufferIndex.ToString(CultureInfo.InvariantCulture)));
        }
        static internal Exception InvalidDataLength(long length)

Usage Example

Exemple #1
0
        public override long GetBytes(int i, long dataIndex, byte[] buffer, int bufferIndex, int length)
        {
            int maxLen = 0;

            byte[] sourceArray = (byte[])this._values[i];
            maxLen = sourceArray.Length;
            if (dataIndex > 0x7fffffffL)
            {
                throw ADP.InvalidSourceBufferIndex(maxLen, dataIndex, "dataIndex");
            }
            int sourceIndex = (int)dataIndex;

            if (buffer != null)
            {
                try
                {
                    if (sourceIndex < maxLen)
                    {
                        if ((sourceIndex + length) > maxLen)
                        {
                            maxLen -= sourceIndex;
                        }
                        else
                        {
                            maxLen = length;
                        }
                    }
                    Array.Copy(sourceArray, sourceIndex, buffer, bufferIndex, maxLen);
                }
                catch (Exception exception)
                {
                    if (ADP.IsCatchableExceptionType(exception))
                    {
                        maxLen = sourceArray.Length;
                        if (length < 0)
                        {
                            throw ADP.InvalidDataLength((long)length);
                        }
                        if ((bufferIndex < 0) || (bufferIndex >= buffer.Length))
                        {
                            throw ADP.InvalidDestinationBufferIndex(length, bufferIndex, "bufferIndex");
                        }
                        if ((dataIndex < 0L) || (dataIndex >= maxLen))
                        {
                            throw ADP.InvalidSourceBufferIndex(length, dataIndex, "dataIndex");
                        }
                        if ((maxLen + bufferIndex) > buffer.Length)
                        {
                            throw ADP.InvalidBufferSizeOrIndex(maxLen, bufferIndex);
                        }
                    }
                    throw;
                }
            }
            return((long)maxLen);
        }
All Usage Examples Of System.Data.Common.ADP::InvalidBufferSizeOrIndex
ADP