System.IO.Ports.SerialPort: Method Members

The methods of System.IO.Ports.SerialPort are listed below. For a list of all members, see the SerialPort Members list.

See Also: Inherited members from System.ComponentModel.Component

Public Methods

Close()

Closes the port connection, sets the SerialPort.IsOpen property to false, and disposes of the internal System.IO.Stream object.

DiscardInBuffer()

Discards data from the serial driver's receive buffer.

DiscardOutBuffer()

Discards data from the serial driver's transmit buffer.

static
GetPortNames() : string[]

Gets an array of serial port names for the current computer.

Open()

Opens a new serial port connection.

Read(byte[], int, int) : int

Reads a number of bytes from the System.IO.Ports.SerialPort input buffer and writes those bytes into a byte array at the specified offset.

Read(char[], int, int) : int

Reads a number of characters from the System.IO.Ports.SerialPort input buffer and writes them into an array of characters at a given offset.

ReadByte() : int

Synchronously reads one byte from the System.IO.Ports.SerialPort input buffer.

ReadChar() : int

Synchronously reads one character from the System.IO.Ports.SerialPort input buffer.

ReadExisting() : string

Reads all immediately available bytes, based on the encoding, in both the stream and the input buffer of the System.IO.Ports.SerialPort object.

ReadLine() : string

Reads up to the SerialPort.NewLine value in the input buffer.

ReadTo(string) : string

Reads a string up to the specified value in the input buffer.

Write(string)

Writes the specified string to the serial port.

Write(byte[], int, int)

Writes a specified number of bytes to the serial port using data from a buffer.

Write(char[], int, int)

Writes a specified number of characters to the serial port using data from a buffer.

WriteLine(string)

Writes the specified string and the SerialPort.NewLine value to the output buffer.

Protected Methods

override
Dispose(bool)

Releases the unmanaged resources used by the System.IO.Ports.SerialPort and optionally releases the managed resources.