← Interactive API Explorer
Namespace: System.IO.Ports

SerialPort

Represents a serial port resource.

Properties (10)

Stream BaseStream
Gets the underlying Stream object for a SerialPort object.
Value: A Stream object.
int BaudRate
Gets or sets the serial baud rate.
Value: The baud rate.
int DataBits
Gets or sets the standard length of data bits per byte.
Value: The data bits length.
Parity Parity
Gets or sets the parity-checking protocol.
Value: One of the enumeration values that represents the parity-checking protocol. The default is None.
StopBits StopBits
Gets or sets the standard number of stopbits per byte.
Value: One of the StopBits values.
Handshake Handshake
Gets or sets the handshaking protocol for serial port transmission of data using a value from Handshake.
Value: One of the Handshake values. The default is None.
bool IsOpen
Gets a value indicating the open or closed status of the SerialPort object.
Value: true if the serial port is open; otherwise, false. The default is false.
bool BreakState
Gets or sets the break signal state.
Value: true if the port is in a break state; otherwise, false.
bool DtrEnable
Gets or sets a value that enables the Data Terminal Ready (DTR) signal during serial communication.
Value: true to enable Data Terminal Ready (DTR); otherwise, false. The default is false.
bool RtsEnable
Gets or sets a value indicating whether the Request to Send (RTS) signal is enabled during serial communication.
Value: true to enable Request to Transmit (RTS); otherwise, false. The default is false.

Methods (7)

SerialPort(String,Int32,IO.Ports.Parity,Int32,IO.Ports.StopBits)Constructor
Initializes a new instance of the SerialPort class using the specified port name, baud rate, parity bit, data bits, and stop bit.
ParameterDescription
portNameThe port to use (for example, COM1).
baudRateThe baud rate.
parityOne of the Parity values.
dataBitsThe data bits value.
stopBitsOne of the StopBits values.
SerialPort(String,Int32,IO.Ports.Parity,Int32)Constructor
Initializes a new instance of the SerialPort class using the specified port name, baud rate, parity bit, and data bits.
ParameterDescription
portNameThe port to use (for example, COM1).
baudRateThe baud rate.
parityOne of the Parity values.
dataBitsThe data bits value.
SerialPort(String,Int32,IO.Ports.Parity)Constructor
Initializes a new instance of the SerialPort class using the specified port name, baud rate, and parity bit.
ParameterDescription
portNameThe port to use (for example, COM1).
baudRateThe baud rate.
parityOne of the Parity values.
SerialPort(String,Int32)Constructor
Initializes a new instance of the SerialPort class using the specified port name and baud rate.
ParameterDescription
portNameThe port to use (for example, COM1).
baudRateThe baud rate.
SerialPort(String)Constructor
Initializes a new instance of the SerialPort class using the specified port name.
ParameterDescription
portNameThe port to use (for example, COM1).
void Open
Opens a new serial port connection.
String[] GetPortNames
Gets an array of serial port names for the current computer.
Returns: An array of serial port names for the current computer.