SerialPort.ReadBufferSize Property

Definition

Gets or sets the size of the SerialPort input buffer.

public int ReadBufferSize { get; set; }
[System.ComponentModel.Browsable(true)]
public int ReadBufferSize { get; set; }

Property Value

The buffer size, in bytes. The default value is 4096; the maximum value is that of a positive int, or 2147483647.

Attributes

Exceptions

The ReadBufferSize value set is less than or equal to zero.

The ReadBufferSize property was set while the stream was open.

The ReadBufferSize property was set to an odd integer value.

Remarks

The ReadBufferSize property ignores any value smaller than 4096.

Because the ReadBufferSize property represents only the Windows-created buffer, it can return a smaller value than the BytesToRead property, which represents both the SerialPort buffer and the Windows-created buffer.

Applies to

Produit Versions
.NET 8 (package-provided), 9 (package-provided)
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7 (package-provided), 4.7, 4.7.1 (package-provided), 4.7.1, 4.7.2 (package-provided), 4.7.2, 4.8 (package-provided), 4.8, 4.8.1
.NET Standard 2.0 (package-provided)