Parity Enumeration
Specifies the parity bit for a SerialPort object.
Assembly: System (in System.dll)
Use this enumeration when setting the Parity property for a serial port connection.
Parity is an error-checking procedure in which the number of 1s must always be the same—either even or odd—for each group of bits that is transmitted without error. In modem-to-modem communications, parity is often one of the parameters that must be agreed upon by sending parties and receiving parties before transmission can take place.
The following code example displays the possible values of the Parity 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.
static Parity SetPortParity(Parity defaultPortParity) { String^ parity; Console::WriteLine("Available Parity options:"); for each (String^ s in Enum::GetNames(Parity::typeid)) { Console::WriteLine(" {0}", s); } Console::Write("Parity({0}):", defaultPortParity.ToString()); parity = Console::ReadLine(); if (parity == "") { parity = defaultPortParity.ToString(); } return (Parity)Enum::Parse(Parity::typeid, parity); }
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.