OracleDataReader.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:
virtual long GetChars(int i, long fieldOffset, cli::array <char> ^ buffer2, int bufferoffset, int length);
public:
override long GetChars(int i, long fieldOffset, cli::array <char> ^ buffer2, int bufferoffset, int length);
public long GetChars (int i, long fieldOffset, char[] buffer2, int bufferoffset, int length);
public override long GetChars (int i, long fieldOffset, char[] buffer2, int bufferoffset, int length);
abstract member GetChars : int * int64 * char[] * int * int -> int64
override this.GetChars : int * int64 * char[] * int * int -> int64
override this.GetChars : int * int64 * char[] * int * int -> int64
Public Function GetChars (i As Integer, fieldOffset As Long, buffer2 As Char(), bufferoffset As Integer, length As Integer) As Long
Public Overrides Function GetChars (i As Integer, fieldOffset As Long, buffer2 As Char(), bufferoffset As Integer, length As Integer) As Long
参数
- i
- Int32
从零开始的列序号。The zero-based column ordinal.
- fieldOffset
- Int64
行中读取操作开始位置的索引。The index within the row where the read operation is to begin.
- buffer2
- Char[]
要向其中复制数据的缓冲区。The buffer into which to copy data.
- bufferoffset
- Int32
buffer2 开始写操作位置的索引。The index where buffer2 is to begin the write operation.
- length
- Int32
要读取的字符数。The number of characters to read.
返回
读取的实际字符数。The actual number of characters read.
实现
注解
GetChars 返回字段中的可用字符数。GetChars returns the number of available characters in the field. 在大多数情况下,这是字段的确切长度。In most cases this is the exact length of the field. 但是,如果 GetChars 已用于从字段获取字符,则返回的数字可能小于字段的真实长度。However, the number returned may be less than the true length of the field if GetChars has already been used to obtain characters from the field. 例如,如果 OracleDataReader 正在将大数据结构读入缓冲区,则可能会出现这种情况。This may be the case, for example, if the OracleDataReader is reading a large data structure into a buffer. 有关详细信息,请参阅的 SequentialAccess 设置 CommandBehavior 。For more information, see the SequentialAccess setting of CommandBehavior.
如果传递的缓冲区为 null 值,则为。If you pass a buffer that is a null value. GetChars 返回字段的长度(以字符为限)。GetChars returns the length of the field in characters.