IDataRecord.GetChars(Int32, Int64, Char[], Int32, Int32) 方法

定义

将字符流从指定列偏移量读入到缓冲区中,将其作为从给定缓冲区偏移量开始的数组。Reads a stream of characters from the specified column offset into the buffer as an array, starting at the given buffer offset.

public:
 long GetChars(int i, long fieldoffset, cli::array <char> ^ buffer, int bufferoffset, int length);
public long GetChars (int i, long fieldoffset, char[] buffer, int bufferoffset, int length);
abstract member GetChars : int * int64 * char[] * int * int -> int64
Public Function GetChars (i As Integer, fieldoffset As Long, buffer As Char(), bufferoffset As Integer, length As Integer) As Long

参数

i
Int32

从零开始的列序号。The zero-based column ordinal.

fieldoffset
Int64

行中作为读取操作起始位置的索引。The index within the row from which to start the read operation.

buffer
Char[]

要读入字节流的缓冲区。The buffer into which to read the stream of bytes.

bufferoffset
Int32

开始读取操作的 buffer 的索引。The index for buffer to start the read operation.

length
Int32

要读取的字节数。The number of bytes to read.

返回

读取的实际字符数。The actual number of characters read.

异常

传递的索引位于 0 至 FieldCount 的范围之外。The index passed was outside the range of 0 through FieldCount.

注解

GetChars返回字段中的可用字符数。GetChars returns the number of available characters in the field. 通常, 这是字段的准确长度。Frequently this is the exact length of the field. 但是, 如果GetChars已使用从字段获取字符, 则返回的数字可能小于字段的准确长度。However, the number returned may be less than the exact length of the field if GetChars has already been used to obtain characters from the field.

如果传递的缓冲区为null, 则返回字段的长度 (以字符为表示)。 GetCharsIf you pass a buffer that is null, GetChars returns the length of the field in characters.

不执行任何转换;因此, 检索的数据必须已是字符数组。No conversions are performed; therefore the data retrieved must already be a character array.

适用于