SerialPort.NewLine Property

Definition

Gets or sets the value used to interpret the end of a call to the ReadLine() and WriteLine(String) methods.

C#
public string NewLine { get; set; }
C#
[System.ComponentModel.Browsable(false)]
public string NewLine { get; set; }

Property Value

A value that represents the end of a line. The default is a line feed ("\n" in C# or vbLf in Visual Basic).

Attributes

Exceptions

The property value is empty.

The property value is null.

Remarks

This property determines what value (byte) defines the end of a line for the ReadLine and WriteLine methods. By default the end-of-line value is a line feed character (\n in C#, Constants.vbLf in Visual Basic). You would change this to a different value if the particular serial device you're working with uses a different value for the same purpose.

Applies to

Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (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, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)