SerialPort.Encoding Property


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Gets or sets the byte encoding for pre- and post-transmission conversion of text.

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

public Encoding Encoding { get; set; }

Property Value

Type: System.Text.Encoding

An Encoding object. The default is ASCIIEncoding.

Exception Condition

The Encoding property was set to null.


The Encoding property was set to an encoding that is not ASCIIEncoding, UTF8Encoding, UTF32Encoding, UnicodeEncoding, one of the Windows single byte encodings, or one of the Windows double byte encodings.

.NET Framework
Available since 2.0
Return to top