Export (0) Print
Expand All

SerialPort.BytesToRead Property

Gets the number of bytes of data in the receive buffer.

Namespace:  System.IO.Ports
Assembly:  System (in System.dll)

[BrowsableAttribute(false)]
public int BytesToRead { get; }

Property Value

Type: System.Int32
The number of bytes of data in the receive buffer.

ExceptionCondition
InvalidOperationException

The port is not open.

The receive buffer includes the serial driver's receive buffer as well as internal buffering in the SerialPort object itself.

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.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft