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

InvalidDestinationBufferIndex() static private méthode

static private InvalidDestinationBufferIndex ( int maxLen, int dstOffset, string parameterName ) : ArgumentOutOfRangeException
maxLen int
dstOffset int
parameterName string
Résultat System.ArgumentOutOfRangeException
        static internal ArgumentOutOfRangeException InvalidDestinationBufferIndex(int maxLen, int dstOffset, string parameterName)
        {
            return ArgumentOutOfRange(Res.GetString(Res.ADP_InvalidDestinationBufferIndex, maxLen.ToString(CultureInfo.InvariantCulture), dstOffset.ToString(CultureInfo.InvariantCulture)), parameterName);
        }
        static internal IndexOutOfRangeException InvalidBufferSizeOrIndex(int numBytes, int bufferIndex)

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::InvalidDestinationBufferIndex
ADP