System.IO.Ports.SerialPort.Close C# (CSharp) Method

Close() public method

public Close ( ) : void
return void
		public void Close ()
		{
			Dispose (true);
		}

Usage Example

		bool IsPVC(SerialPort port)
		{
			string returnMessage = "";
			try {
				if (port.IsOpen)
					port.Close ();

				port.Open ();

				Thread.Sleep (1500); // Fails if this delay is any shorter

				port.Write ("#");
				port.Write (port.NewLine);

				Thread.Sleep (500); // Fails if this delay is any shorter

				int count = port.BytesToRead;
				int intReturnASCII = 0;
				while (count > 0) {
					intReturnASCII = port.ReadByte ();
					returnMessage = returnMessage + Convert.ToChar (intReturnASCII);
					count--;
				}
			} catch {
			} finally {
				port.Close ();
			}
			if (returnMessage.Contains (Identifier)) {
				return true;
			} else {
				return false;
			}
		}
All Usage Examples Of System.IO.Ports.SerialPort::Close