WebApplications.Testing.Data.ObjectRecord.GetChars C# (CSharp) Method

GetChars() public method

public GetChars ( int i, long fieldOffset, char buffer, int bufferoffset, int length ) : long
i int
fieldOffset long
buffer char
bufferoffset int
length int
return long
        public long GetChars(int i, long fieldOffset, char[] buffer, int bufferoffset, int length)
        {
            if (buffer == null) throw new ArgumentNullException("buffer");
            if ((i < 0) ||
                (i > FieldCount))
                throw new IndexOutOfRangeException(i.ToString(CultureInfo.InvariantCulture));

            object o = _columnValues[i];
            if (o == null)
                throw new SqlNullValueException();
            if (!(o is char[]))
                throw new InvalidCastException();
            char[] chars = (char[])o;
            length = (chars.Length - fieldOffset) < length ? (int)(chars.Length - fieldOffset) : length;
            Debug.Assert(length >= 0);
            Array.Copy(chars, fieldOffset, buffer, bufferoffset, length);
            return length;
        }