SerialPort.Close Method

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

Namespace: System.IO.Ports
Assembly: Microsoft.SPOT.Hardware (in microsoft.spot.hardware.dll)

Syntax

[MethodImplAttribute(Synchronized)]
public void Close ()

Remarks

Calling this method closes the SerialPort object and clears both the receive and transmit buffers. The best practice for any application is to wait for some amount of time after calling the Close method before attempting to call the Open method, as the port may not be closed instantly.

Version Information

Available in the .NET Micro Framework versions 3.0, 4.0, and 4.1.

See Also

Reference

SerialPort Class
SerialPort Members
System.IO.Ports Namespace