public void Write (long offset, char [] buffer, int offsetInBuffer, int count) { if (count > this.MaxLength || ((count + offset) > this.MaxLength) || count > buffer.Length || count < 0 || ((offsetInBuffer + count) > buffer.Length)) throw new SqlTypeException ("The buffer is insufficient. Read or write operation failed."); if (offset < 0 || offset > MaxLength) throw new SqlTypeException ("The buffer is insufficient. Read or write operation failed."); if (offsetInBuffer < 0 || offsetInBuffer > buffer.Length || offsetInBuffer > this.Length) throw new ArgumentOutOfRangeException ("offsetInBuffer"); if (this.IsNull) throw new SqlTypeException ("There is no buffer. Read or write operation failed."); if (buffer == null) throw new ArgumentNullException ("buffer"); if (count + offset > this.Length && count + offset < this.MaxLength+1) SetLength (count); Array.Copy (buffer, offsetInBuffer, this.buffer, offset, count); }