SerialPort.BytesToRead 屬性

定義

取得接收緩衝區中的資料位元組數。Gets the number of bytes of data in the receive buffer.

public:
 property int BytesToRead { int get(); };
public int BytesToRead { get; }
[System.ComponentModel.Browsable(false)]
public int BytesToRead { get; }
member this.BytesToRead : int
[<System.ComponentModel.Browsable(false)>]
member this.BytesToRead : int
Public ReadOnly Property BytesToRead As Integer

屬性值

Int32

接收緩衝區中的資料位元組數。The number of bytes of data in the receive buffer.

屬性

例外狀況

連接埠未開啟。The port is not open.

備註

接收緩衝區包含序列驅動程式的接收緩衝區以及物件本身的內部緩衝 SerialPortThe receive buffer includes the serial driver's receive buffer as well as internal buffering in the SerialPort object itself.

因為 BytesToRead 屬性同時代表 SerialPort 緩衝區和 Windows 建立的緩衝區,所以它可能會傳回比屬性更大的值 ReadBufferSize ,此屬性只代表 Windows 建立的緩衝區。Because the BytesToRead property represents both the SerialPort buffer and the Windows-created buffer, it can return a greater value than the ReadBufferSize property, which represents only the Windows-created buffer.

適用於