I am using SerialPort class to communicate with an external device. I start the communication at 300 Baud per second however after the initial \"handshake\" I have to switch
It turns out you can change SerialPort.BaudRate while it is open. But the SerialPort.DiscardInBuffer that is mentioned in answer by @Groo is a good tip!
From my experience so far, the safest bet is to close the connection first, change the rate, and then open it again. Your device won't mind this, as it probably waits for you to send some control characters to make sure the speed has been changed.
You can try changing the baud rate while the port is open, but this may result in invalid characters being detected in the buffer (depending on the device and the protocol), which means you should also clear the buffers immediately after the change (using SerialPort.DiscardInBuffer()).