SqlDataReader.GetBytes(Int32, Int64, Byte[], Int32, Int32) メソッド

定義

指定した列オフセットからバッファーにバイト ストリームを配列として読み取ります。その際、指定したバッファー オフセット位置から開始します。

public:
 override long GetBytes(int i, long dataIndex, cli::array <System::Byte> ^ buffer, int bufferIndex, int length);
public:
 virtual long GetBytes(int i, long dataIndex, cli::array <System::Byte> ^ buffer, int bufferIndex, int length);
public override long GetBytes (int i, long dataIndex, byte[] buffer, int bufferIndex, int length);
public long GetBytes (int i, long dataIndex, byte[] buffer, int bufferIndex, int length);
override this.GetBytes : int * int64 * byte[] * int * int -> int64
abstract member GetBytes : int * int64 * byte[] * int * int -> int64
override this.GetBytes : int * int64 * byte[] * int * int -> int64
Public Overrides Function GetBytes (i As Integer, dataIndex As Long, buffer As Byte(), bufferIndex As Integer, length As Integer) As Long
Public Function GetBytes (i As Integer, dataIndex As Long, buffer As Byte(), bufferIndex As Integer, length As Integer) As Long

パラメーター

i
Int32

0 から始まる列序数。

dataIndex
Int64

読み取り操作の開始位置を示す、フィールド内のインデックスです。

buffer
Byte[]

バイトのストリームを読み込むバッファー。

bufferIndex
Int32

書き込み操作を開始する buffer 内のインデックス。

length
Int32

バッファーにコピーする最大長。

戻り値

実際に読み取られたバイト数。

実装

注釈

GetBytes は、フィールドで使用可能なバイト数を返します。 ほとんどの場合、これはフィールドの正確な長さです。 ただし、フィールドからバイトを取得するために既に使用されている場合は、返される数値がフィールドの実際の長さよりも小さい場合 GetBytes があります。 たとえば、 が大きなデータ構造を SqlDataReader バッファーに読み取る場合などです。 詳細については、 の設定CommandBehaviorSequentialAccess参照してください。

であるnullGetBytesバッファーを渡すと、バッファー オフセット パラメーターに基づく残りのサイズではなく、フィールド全体の長さがバイト単位で返されます。

変換は実行されません。したがって、取得されるデータは既にバイト配列である必要があります。

適用対象

こちらもご覧ください