StopBits Enumeration
Specifies the number of stop bits used on the SerialPort object.
Namespace: System.IO.Ports
Assembly: System (in System.dll)
You use this enumeration when setting the value of the StopBits property on the SerialPort class. Stop bits separate each unit of data on an asynchronous serial connection. They are also sent continuously when no data is available for transmission.
The SerialPort class throws an ArgumentOutOfRangeException exception when you set the StopBits property to None.
The following example shows how to set the StopBits property to One.
The following code example displays the possible values of the StopBits enumeration to the console, then prompts the user to choose one. This code example is part of a larger code example provided for the SerialPort class.
public static StopBits SetPortStopBits(StopBits defaultPortStopBits) { string stopBits; Console.WriteLine("Available Stop Bits options:"); foreach (string s in Enum.GetNames(typeof(StopBits))) { Console.WriteLine(" {0}", s); } Console.Write("Stop Bits({0}):", defaultPortStopBits.ToString()); stopBits = Console.ReadLine(); if (stopBits == "") { stopBits = defaultPortStopBits.ToString(); } return (StopBits)Enum.Parse(typeof(StopBits), stopBits); }
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.