Search code examples
c#serial-portdispose

dispose serial port


I am using using class System.IO.Ports. In some cases this component still runs even when the program is closed. As a result I can not open the new serial port with the same port name, cause it is already opened.

Please, is there any way how to dispose System.IO.Ports in c#?


Solution

  • You're looking for the cunningly-named Dispose method.