API Reference
Class
DataReaderUtf8TextExtensions
Reads borrowed or copied UTF-8 text from ordinary tabular records.
Inheritance
- Object
- DataReaderUtf8TextExtensions
Methods
public static Int64 GetUtf8Bytes(IDataRecord record, Int32 ordinal, Int64 dataOffset, Byte[] buffer, Int32 bufferOffset, Int32 length) #Returns:
Int64Copies a byte segment of the current field's UTF-8 text into a caller-owned buffer.
Parameters
- record System.Data.IDataRecord
- The record containing the current row.
- ordinal System.Int32
- The zero-based field ordinal.
- dataOffset System.Int64
- The zero-based byte offset in the encoded text.
- buffer System.Byte[]
- The destination, or null to query the total encoded byte length.
- bufferOffset System.Int32
- The zero-based destination byte offset.
- length System.Int32
- The maximum number of bytes to copy.
Returns
The number of copied bytes, or the total UTF-8 byte length when buffer is null.
Exceptions
ArgumentNullException– The record is null.ArgumentOutOfRangeException– An offset or length is negative, or bufferOffset exceeds the buffer length.ArgumentException– The requested destination segment extends beyond the buffer.IndexOutOfRangeException– The ordinal is outside the record's fields.
public static Boolean TryGetUtf8Text(IDataRecord record, Int32 ordinal, out ReadOnlySpan<Byte> text) #Returns:
BooleanAttempts to borrow text from a record that implements IDataReaderUtf8TextSource.
Parameters
- record System.Data.IDataRecord
- The record containing the current row.
- ordinal System.Int32
- The zero-based field ordinal.
- text System.ReadOnlySpan{System.Byte}@
- The borrowed text when successful; otherwise an empty span.
Returns
False when the record or field does not offer borrowed UTF-8 text.
Exceptions
ArgumentNullException– The record is null.IndexOutOfRangeException– The ordinal is outside the record's fields.