Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
2853 lines (2564 sloc) 198 KB
<Type Name="SerialPort" FullName="System.IO.Ports.SerialPort">
<TypeSignature Language="C#" Value="public class SerialPort : System.ComponentModel.Component" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit SerialPort extends System.ComponentModel.Component" />
<TypeSignature Language="DocId" Value="T:System.IO.Ports.SerialPort" />
<TypeSignature Language="VB.NET" Value="Public Class SerialPort&#xA;Inherits Component" />
<TypeSignature Language="C++ CLI" Value="public ref class SerialPort : System::ComponentModel::Component" />
<TypeSignature Language="F#" Value="type SerialPort = class&#xA; inherit Component" />
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.IO.Ports</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.ComponentModel.Component</BaseTypeName>
</Base>
<Interfaces />
<Attributes>
<Attribute FrameworkAlternate="xamarinmac-3.0">
<AttributeName>System.Diagnostics.MonitoringDescription("")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>System.Diagnostics.MonitoringDescription("SerialPortDesc")</AttributeName>
</Attribute>
</Attributes>
<Docs>
<summary>Represents a serial port resource.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use this class to control a serial port file resource. This class provides synchronous and event-driven I/O, access to pin and break states, and access to serial driver properties. Additionally, the functionality of this class can be wrapped in an internal <xref:System.IO.Stream> object, accessible through the <xref:System.IO.Ports.SerialPort.BaseStream%2A> property, and passed to classes that wrap or use streams.
The <xref:System.IO.Ports.SerialPort> class supports the following encodings: <xref:System.Text.ASCIIEncoding>, <xref:System.Text.UTF8Encoding>, <xref:System.Text.UnicodeEncoding>, <xref:System.Text.UTF32Encoding>, and any encoding defined in mscorlib.dll where the code page is less than 50000 or the code page is 54936. You can use alternate encodings, but you must use the <xref:System.IO.Ports.SerialPort.ReadByte%2A> or <xref:System.IO.Ports.SerialPort.Write%2A> method and perform the encoding yourself.
You use the <xref:System.IO.Ports.SerialPort.GetPortNames%2A> method to retrieve the valid ports for the current computer.
If a <xref:System.IO.Ports.SerialPort> object becomes blocked during a read operation, do not abort the thread. Instead, either close the base stream or dispose of the <xref:System.IO.Ports.SerialPort> object.
## Examples
The following code example demonstrates the use of the <xref:System.IO.Ports.SerialPort> class to allow two users to chat from two separate computers connected by a null modem cable. In this example, the users are prompted for the port settings and a username before chatting. Both computers must be executing the program to achieve full functionality of this example.
[!code-cpp[System.IO.Ports.SerialPort#10](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/cpp/serialport.cpp#10)]
[!code-csharp[System.IO.Ports.SerialPort#10](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/cs/SerialPort.cs#10)]
[!code-vb[System.IO.Ports.SerialPort#10](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/vb/SerialPort.vb#10)]
]]></format>
</remarks>
<permission cref="T:System.Security.Permissions.SecurityPermission">for the ability to call unmanaged code. Associated enumeration: <see cref="F:System.Security.Permissions.SecurityPermissionFlag.UnmanagedCode" /></permission>
</Docs>
<Members>
<MemberGroup MemberName=".ctor">
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Initializes a new instance of the <see cref="T:System.IO.Ports.SerialPort" /> class.</summary>
</Docs>
</MemberGroup>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public SerialPort ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" />
<MemberSignature Language="DocId" Value="M:System.IO.Ports.SerialPort.#ctor" />
<MemberSignature Language="VB.NET" Value="Public Sub New ()" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; SerialPort();" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.IO.Ports</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
</AssemblyInfo>
<Parameters />
<Docs>
<summary>Initializes a new instance of the <see cref="T:System.IO.Ports.SerialPort" /> class.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This constructor uses default property values when none are specified. For example, the <xref:System.IO.Ports.SerialPort.DataBits%2A> property defaults to 8, the <xref:System.IO.Ports.SerialPort.Parity%2A> property defaults to the `None` enumeration value, the <xref:System.IO.Ports.SerialPort.StopBits%2A> property defaults to 1, and a default port name of COM1.
## Examples
The following code example demonstrates the use of the <xref:System.IO.Ports.SerialPort> class to allow two users to chat from two separate computers connected by a null modem cable. In this example, the users are prompted for the port settings and a username before chatting. This code example is part of a larger code example provided for the <xref:System.IO.Ports.SerialPort> class.
[!code-cpp[System.IO.Ports.SerialPort#01](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/cpp/serialport.cpp#01)]
[!code-csharp[System.IO.Ports.SerialPort#01](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/cs/SerialPort.cs#01)]
[!code-vb[System.IO.Ports.SerialPort#01](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/vb/SerialPort.vb#01)]
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public SerialPort (System.ComponentModel.IContainer container);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.ComponentModel.IContainer container) cil managed" />
<MemberSignature Language="DocId" Value="M:System.IO.Ports.SerialPort.#ctor(System.ComponentModel.IContainer)" />
<MemberSignature Language="VB.NET" Value="Public Sub New (container As IContainer)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; SerialPort(System::ComponentModel::IContainer ^ container);" />
<MemberSignature Language="F#" Value="new System.IO.Ports.SerialPort : System.ComponentModel.IContainer -&gt; System.IO.Ports.SerialPort" Usage="new System.IO.Ports.SerialPort container" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.IO.Ports</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
</AssemblyInfo>
<Parameters>
<Parameter Name="container" Type="System.ComponentModel.IContainer" />
</Parameters>
<Docs>
<param name="container">An interface to a container.</param>
<summary>Initializes a new instance of the <see cref="T:System.IO.Ports.SerialPort" /> class using the specified <see cref="T:System.ComponentModel.IContainer" /> object.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This constructor uses default property values when none are specified. For example, the <xref:System.IO.Ports.SerialPort.DataBits%2A> property defaults to 8, the <xref:System.IO.Ports.SerialPort.Parity%2A> property defaults to the `None` enumeration value, the <xref:System.IO.Ports.SerialPort.StopBits%2A> property defaults to 1, and a default port name of COM1.
]]></format>
</remarks>
<exception cref="T:System.IO.IOException">The specified port could not be found or opened.</exception>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public SerialPort (string portName);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string portName) cil managed" />
<MemberSignature Language="DocId" Value="M:System.IO.Ports.SerialPort.#ctor(System.String)" />
<MemberSignature Language="VB.NET" Value="Public Sub New (portName As String)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; SerialPort(System::String ^ portName);" />
<MemberSignature Language="F#" Value="new System.IO.Ports.SerialPort : string -&gt; System.IO.Ports.SerialPort" Usage="new System.IO.Ports.SerialPort portName" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.IO.Ports</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<Parameters>
<Parameter Name="portName" Type="System.String" />
</Parameters>
<Docs>
<param name="portName">The port to use (for example, COM1).</param>
<summary>Initializes a new instance of the <see cref="T:System.IO.Ports.SerialPort" /> class using the specified port name.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use this constructor to create a new instance of the <xref:System.IO.Ports.SerialPort> class when you want to specify the port name.
]]></format>
</remarks>
<exception cref="T:System.IO.IOException">The specified port could not be found or opened.</exception>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public SerialPort (string portName, int baudRate);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string portName, int32 baudRate) cil managed" />
<MemberSignature Language="DocId" Value="M:System.IO.Ports.SerialPort.#ctor(System.String,System.Int32)" />
<MemberSignature Language="VB.NET" Value="Public Sub New (portName As String, baudRate As Integer)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; SerialPort(System::String ^ portName, int baudRate);" />
<MemberSignature Language="F#" Value="new System.IO.Ports.SerialPort : string * int -&gt; System.IO.Ports.SerialPort" Usage="new System.IO.Ports.SerialPort (portName, baudRate)" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.IO.Ports</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<Parameters>
<Parameter Name="portName" Type="System.String" />
<Parameter Name="baudRate" Type="System.Int32" />
</Parameters>
<Docs>
<param name="portName">The port to use (for example, COM1).</param>
<param name="baudRate">The baud rate.</param>
<summary>Initializes a new instance of the <see cref="T:System.IO.Ports.SerialPort" /> class using the specified port name and baud rate.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use this constructor to create a new instance of the <xref:System.IO.Ports.SerialPort> class when you want to specify the port name and the baud rate.
]]></format>
</remarks>
<exception cref="T:System.IO.IOException">The specified port could not be found or opened.</exception>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public SerialPort (string portName, int baudRate, System.IO.Ports.Parity parity);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string portName, int32 baudRate, valuetype System.IO.Ports.Parity parity) cil managed" />
<MemberSignature Language="DocId" Value="M:System.IO.Ports.SerialPort.#ctor(System.String,System.Int32,System.IO.Ports.Parity)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; SerialPort(System::String ^ portName, int baudRate, System::IO::Ports::Parity parity);" />
<MemberSignature Language="F#" Value="new System.IO.Ports.SerialPort : string * int * System.IO.Ports.Parity -&gt; System.IO.Ports.SerialPort" Usage="new System.IO.Ports.SerialPort (portName, baudRate, parity)" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.IO.Ports</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<Parameters>
<Parameter Name="portName" Type="System.String" />
<Parameter Name="baudRate" Type="System.Int32" />
<Parameter Name="parity" Type="System.IO.Ports.Parity" />
</Parameters>
<Docs>
<param name="portName">The port to use (for example, COM1).</param>
<param name="baudRate">The baud rate.</param>
<param name="parity">One of the <see cref="P:System.IO.Ports.SerialPort.Parity" /> values.</param>
<summary>Initializes a new instance of the <see cref="T:System.IO.Ports.SerialPort" /> class using the specified port name, baud rate, and parity bit.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use this constructor to create a new instance of the <xref:System.IO.Ports.SerialPort> class when you want to specify the port name, the baud rate, and the parity bit.
]]></format>
</remarks>
<exception cref="T:System.IO.IOException">The specified port could not be found or opened.</exception>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public SerialPort (string portName, int baudRate, System.IO.Ports.Parity parity, int dataBits);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string portName, int32 baudRate, valuetype System.IO.Ports.Parity parity, int32 dataBits) cil managed" />
<MemberSignature Language="DocId" Value="M:System.IO.Ports.SerialPort.#ctor(System.String,System.Int32,System.IO.Ports.Parity,System.Int32)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; SerialPort(System::String ^ portName, int baudRate, System::IO::Ports::Parity parity, int dataBits);" />
<MemberSignature Language="F#" Value="new System.IO.Ports.SerialPort : string * int * System.IO.Ports.Parity * int -&gt; System.IO.Ports.SerialPort" Usage="new System.IO.Ports.SerialPort (portName, baudRate, parity, dataBits)" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.IO.Ports</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<Parameters>
<Parameter Name="portName" Type="System.String" />
<Parameter Name="baudRate" Type="System.Int32" />
<Parameter Name="parity" Type="System.IO.Ports.Parity" />
<Parameter Name="dataBits" Type="System.Int32" />
</Parameters>
<Docs>
<param name="portName">The port to use (for example, COM1).</param>
<param name="baudRate">The baud rate.</param>
<param name="parity">One of the <see cref="P:System.IO.Ports.SerialPort.Parity" /> values.</param>
<param name="dataBits">The data bits value.</param>
<summary>Initializes a new instance of the <see cref="T:System.IO.Ports.SerialPort" /> class using the specified port name, baud rate, parity bit, and data bits.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use this constructor to create a new instance of the <xref:System.IO.Ports.SerialPort> class when you want to specify the port name, the baud rate, the parity bit, and data bits.
]]></format>
</remarks>
<exception cref="T:System.IO.IOException">The specified port could not be found or opened.</exception>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public SerialPort (string portName, int baudRate, System.IO.Ports.Parity parity, int dataBits, System.IO.Ports.StopBits stopBits);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string portName, int32 baudRate, valuetype System.IO.Ports.Parity parity, int32 dataBits, valuetype System.IO.Ports.StopBits stopBits) cil managed" />
<MemberSignature Language="DocId" Value="M:System.IO.Ports.SerialPort.#ctor(System.String,System.Int32,System.IO.Ports.Parity,System.Int32,System.IO.Ports.StopBits)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; SerialPort(System::String ^ portName, int baudRate, System::IO::Ports::Parity parity, int dataBits, System::IO::Ports::StopBits stopBits);" />
<MemberSignature Language="F#" Value="new System.IO.Ports.SerialPort : string * int * System.IO.Ports.Parity * int * System.IO.Ports.StopBits -&gt; System.IO.Ports.SerialPort" Usage="new System.IO.Ports.SerialPort (portName, baudRate, parity, dataBits, stopBits)" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.IO.Ports</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
</AssemblyInfo>
<Parameters>
<Parameter Name="portName" Type="System.String" />
<Parameter Name="baudRate" Type="System.Int32" />
<Parameter Name="parity" Type="System.IO.Ports.Parity" />
<Parameter Name="dataBits" Type="System.Int32" />
<Parameter Name="stopBits" Type="System.IO.Ports.StopBits" />
</Parameters>
<Docs>
<param name="portName">The port to use (for example, COM1).</param>
<param name="baudRate">The baud rate.</param>
<param name="parity">One of the <see cref="P:System.IO.Ports.SerialPort.Parity" /> values.</param>
<param name="dataBits">The data bits value.</param>
<param name="stopBits">One of the <see cref="P:System.IO.Ports.SerialPort.StopBits" /> values.</param>
<summary>Initializes a new instance of the <see cref="T:System.IO.Ports.SerialPort" /> class using the specified port name, baud rate, parity bit, data bits, and stop bit.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use this constructor to create a new instance of the <xref:System.IO.Ports.SerialPort> class when you want to specify the port name, the baud rate, the parity bit, data bits, and stop bit.
]]></format>
</remarks>
<exception cref="T:System.IO.IOException">The specified port could not be found or opened.</exception>
</Docs>
</Member>
<Member MemberName="BaseStream">
<MemberSignature Language="C#" Value="public System.IO.Stream BaseStream { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.IO.Stream BaseStream" />
<MemberSignature Language="DocId" Value="P:System.IO.Ports.SerialPort.BaseStream" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property BaseStream As Stream" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property System::IO::Stream ^ BaseStream { System::IO::Stream ^ get(); };" />
<MemberSignature Language="F#" Value="member this.BaseStream : System.IO.Stream" Usage="System.IO.Ports.SerialPort.BaseStream" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.IO.Ports</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinmac-3.0;netframework-4.8">
<AttributeName>System.ComponentModel.Browsable(false)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinmac-3.0;netframework-4.8">
<AttributeName>System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.IO.Stream</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the underlying <see cref="T:System.IO.Stream" /> object for a <see cref="T:System.IO.Ports.SerialPort" /> object.</summary>
<value>A <see cref="T:System.IO.Stream" /> object.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use this property for explicit asynchronous I/O operations or to pass the <xref:System.IO.Ports.SerialPort> object to a <xref:System.IO.Stream> wrapper class such as <xref:System.IO.StreamWriter>.
Any open serial port's <xref:System.IO.Ports.SerialPort.BaseStream%2A> property returns an object that derives from the abstract <xref:System.IO.Stream> class, and implements read and write methods using the prototypes inherited from the <xref:System.IO.Stream> class: <xref:System.IO.Stream.BeginRead%2A>, <xref:System.IO.Stream.BeginWrite%2A>, <xref:System.IO.Stream.Read%2A>, <xref:System.IO.Stream.ReadByte%2A>, <xref:System.IO.Stream.Write%2A>, and <xref:System.IO.Stream.WriteByte%2A>. These methods can be useful when passing a wrapped serial resource to a <xref:System.IO.Stream> wrapper class.
Due to the inaccessibility of the wrapped file handle, the <xref:System.IO.Stream.Length%2A> and <xref:System.IO.Stream.Position%2A> properties are not supported, and the <xref:System.IO.Stream.Seek%2A> and <xref:System.IO.Stream.SetLength%2A> methods are not supported.
]]></format>
</remarks>
<exception cref="T:System.InvalidOperationException">The stream is closed. This can occur because the <see cref="M:System.IO.Ports.SerialPort.Open" /> method has not been called or the <see cref="M:System.IO.Ports.SerialPort.Close" /> method has been called.</exception>
<exception cref="T:System.NotSupportedException">The stream is in a .NET Compact Framework application and one of the following methods was called:
<see cref="M:System.IO.Stream.BeginRead(System.Byte[],System.Int32,System.Int32,System.AsyncCallback,System.Object)" /><see cref="M:System.IO.Stream.BeginWrite(System.Byte[],System.Int32,System.Int32,System.AsyncCallback,System.Object)" /><see cref="M:System.IO.Stream.EndRead(System.IAsyncResult)" /><see cref="M:System.IO.Stream.EndWrite(System.IAsyncResult)" />
The .NET Compact Framework does not support the asynchronous model with base streams.</exception>
</Docs>
</Member>
<Member MemberName="BaudRate">
<MemberSignature Language="C#" Value="public int BaudRate { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance int32 BaudRate" />
<MemberSignature Language="DocId" Value="P:System.IO.Ports.SerialPort.BaudRate" />
<MemberSignature Language="VB.NET" Value="Public Property BaudRate As Integer" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property int BaudRate { int get(); void set(int value); };" />
<MemberSignature Language="F#" Value="member this.BaudRate : int with get, set" Usage="System.IO.Ports.SerialPort.BaudRate" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.IO.Ports</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinmac-3.0;netframework-4.8">
<AttributeName>System.ComponentModel.Browsable(true)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinmac-3.0;netframework-4.8">
<AttributeName>System.ComponentModel.DefaultValue(9600)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="xamarinmac-3.0">
<AttributeName>System.Diagnostics.MonitoringDescription("")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>System.Diagnostics.MonitoringDescription("BaudRate")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Int32</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the serial baud rate.</summary>
<value>The baud rate.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The baud rate must be supported by the user's serial driver. The default value is 9600 bits per second (bps).
## Examples
The following example shows how to set the <xref:System.IO.Ports.SerialPort.BaudRate%2A> property to `9600`.
[!code-cpp[System.IO.Ports.SerialPort#20](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/cpp/datareceived.cpp#20)]
[!code-csharp[System.IO.Ports.SerialPort#20](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/cs/datareceived.cs#20)]
[!code-vb[System.IO.Ports.SerialPort#20](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/vb/datareceived.vb#20)]
The following example demonstrates the use of the <xref:System.IO.Ports.SerialPort> class to allow two users to chat from two separate computers connected by a null modem cable. In this example, the users are prompted for the port settings and a username before chatting. This code example is part of a larger code example provided for the <xref:System.IO.Ports.SerialPort> class.
[!code-cpp[System.IO.Ports.SerialPort#01](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/cpp/serialport.cpp#01)]
[!code-csharp[System.IO.Ports.SerialPort#01](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/cs/SerialPort.cs#01)]
[!code-vb[System.IO.Ports.SerialPort#01](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/vb/SerialPort.vb#01)]
]]></format>
</remarks>
<exception cref="T:System.ArgumentOutOfRangeException">The baud rate specified is less than or equal to zero, or is greater than the maximum allowable baud rate for the device.</exception>
<exception cref="T:System.IO.IOException">The port is in an invalid state.
-or-
An attempt to set the state of the underlying port failed. For example, the parameters passed from this <see cref="T:System.IO.Ports.SerialPort" /> object were invalid.</exception>
</Docs>
</Member>
<Member MemberName="BreakState">
<MemberSignature Language="C#" Value="public bool BreakState { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool BreakState" />
<MemberSignature Language="DocId" Value="P:System.IO.Ports.SerialPort.BreakState" />
<MemberSignature Language="VB.NET" Value="Public Property BreakState As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property bool BreakState { bool get(); void set(bool value); };" />
<MemberSignature Language="F#" Value="member this.BreakState : bool with get, set" Usage="System.IO.Ports.SerialPort.BreakState" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.IO.Ports</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinmac-3.0;netframework-4.8">
<AttributeName>System.ComponentModel.Browsable(false)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinmac-3.0;netframework-4.8">
<AttributeName>System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the break signal state.</summary>
<value>
<see langword="true" /> if the port is in a break state; otherwise, <see langword="false" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The break signal state occurs when a transmission is suspended and the line is placed in a break state (all low, no stop bit) until released. To enter a break state, set this property to `true`. If the port is already in a break state, setting this property again to `true` does not result in an exception. It is not possible to write to the <xref:System.IO.Ports.SerialPort> object while <xref:System.IO.Ports.SerialPort.BreakState%2A> is `true`.
]]></format>
</remarks>
<exception cref="T:System.IO.IOException">The port is in an invalid state.
-or-
An attempt to set the state of the underlying port failed. For example, the parameters passed from this <see cref="T:System.IO.Ports.SerialPort" /> object were invalid.</exception>
<exception cref="T:System.InvalidOperationException">The stream is closed. This can occur because the <see cref="M:System.IO.Ports.SerialPort.Open" /> method has not been called or the <see cref="M:System.IO.Ports.SerialPort.Close" /> method has been called.</exception>
</Docs>
</Member>
<Member MemberName="BytesToRead">
<MemberSignature Language="C#" Value="public int BytesToRead { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance int32 BytesToRead" />
<MemberSignature Language="DocId" Value="P:System.IO.Ports.SerialPort.BytesToRead" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property BytesToRead As Integer" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property int BytesToRead { int get(); };" />
<MemberSignature Language="F#" Value="member this.BytesToRead : int" Usage="System.IO.Ports.SerialPort.BytesToRead" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.IO.Ports</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinmac-3.0;netframework-4.8">
<AttributeName>System.ComponentModel.Browsable(false)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinmac-3.0;netframework-4.8">
<AttributeName>System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Int32</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the number of bytes of data in the receive buffer.</summary>
<value>The number of bytes of data in the receive buffer.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The receive buffer includes the serial driver's receive buffer as well as internal buffering in the <xref:System.IO.Ports.SerialPort> object itself.
Because the <xref:System.IO.Ports.SerialPort.BytesToRead%2A> property represents both the <xref:System.IO.Ports.SerialPort> buffer and the Windows-created buffer, it can return a greater value than the <xref:System.IO.Ports.SerialPort.ReadBufferSize%2A> property, which represents only the Windows-created buffer.
]]></format>
</remarks>
<exception cref="T:System.InvalidOperationException">The port is not open.</exception>
</Docs>
</Member>
<Member MemberName="BytesToWrite">
<MemberSignature Language="C#" Value="public int BytesToWrite { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance int32 BytesToWrite" />
<MemberSignature Language="DocId" Value="P:System.IO.Ports.SerialPort.BytesToWrite" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property BytesToWrite As Integer" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property int BytesToWrite { int get(); };" />
<MemberSignature Language="F#" Value="member this.BytesToWrite : int" Usage="System.IO.Ports.SerialPort.BytesToWrite" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.IO.Ports</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinmac-3.0;netframework-4.8">
<AttributeName>System.ComponentModel.Browsable(false)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinmac-3.0;netframework-4.8">
<AttributeName>System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Int32</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the number of bytes of data in the send buffer.</summary>
<value>The number of bytes of data in the send buffer.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The send buffer includes the serial driver's send buffer as well as internal buffering in the <xref:System.IO.Ports.SerialPort> object itself.
]]></format>
</remarks>
<exception cref="T:System.IO.IOException">The port is in an invalid state.</exception>
<exception cref="T:System.InvalidOperationException">The stream is closed. This can occur because the <see cref="M:System.IO.Ports.SerialPort.Open" /> method has not been called or the <see cref="M:System.IO.Ports.SerialPort.Close" /> method has been called.</exception>
</Docs>
</Member>
<Member MemberName="CDHolding">
<MemberSignature Language="C#" Value="public bool CDHolding { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool CDHolding" />
<MemberSignature Language="DocId" Value="P:System.IO.Ports.SerialPort.CDHolding" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property CDHolding As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property bool CDHolding { bool get(); };" />
<MemberSignature Language="F#" Value="member this.CDHolding : bool" Usage="System.IO.Ports.SerialPort.CDHolding" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.IO.Ports</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinmac-3.0;netframework-4.8">
<AttributeName>System.ComponentModel.Browsable(false)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinmac-3.0;netframework-4.8">
<AttributeName>System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the state of the Carrier Detect line for the port.</summary>
<value>
<see langword="true" /> if the carrier is detected; otherwise, <see langword="false" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This property can be used to monitor the state of the carrier detection line for a port. No carrier usually indicates that the receiver has hung up and the carrier has been dropped.
]]></format>
</remarks>
<exception cref="T:System.IO.IOException">The port is in an invalid state.
-or-
An attempt to set the state of the underlying port failed. For example, the parameters passed from this <see cref="T:System.IO.Ports.SerialPort" /> object were invalid.</exception>
<exception cref="T:System.InvalidOperationException">The stream is closed. This can occur because the <see cref="M:System.IO.Ports.SerialPort.Open" /> method has not been called or the <see cref="M:System.IO.Ports.SerialPort.Close" /> method has been called.</exception>
</Docs>
</Member>
<Member MemberName="Close">
<MemberSignature Language="C#" Value="public void Close ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void Close() cil managed" />
<MemberSignature Language="DocId" Value="M:System.IO.Ports.SerialPort.Close" />
<MemberSignature Language="VB.NET" Value="Public Sub Close ()" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; void Close();" />
<MemberSignature Language="F#" Value="member this.Close : unit -&gt; unit" Usage="serialPort.Close " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.IO.Ports</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Closes the port connection, sets the <see cref="P:System.IO.Ports.SerialPort.IsOpen" /> property to <see langword="false" />, and disposes of the internal <see cref="T:System.IO.Stream" /> object.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Calling this method closes the <xref:System.IO.Ports.SerialPort> object and clears both the receive and transmit buffers. This method calls the <xref:System.ComponentModel.Component.Dispose?displayProperty=nameWithType> method, which invokes the protected <xref:System.IO.Ports.SerialPort.Dispose%28System.Boolean%29?displayProperty=nameWithType> method with the `disposing` parameter set to `true`.
The best practice for any application is to wait for some amount of time after calling the <xref:System.IO.Ports.SerialPort.Close%2A> method before attempting to call the <xref:System.IO.Ports.SerialPort.Open%2A> method, as the port may not be closed instantly.
## Examples
The following code example demonstrates the use of the <xref:System.IO.Ports.SerialPort> class to allow two users to chat from two separate computers connected by a null modem cable. In this example, the users are prompted for the port settings and a username before chatting. This code example is part of a larger code example provided for the <xref:System.IO.Ports.SerialPort> class.
[!code-cpp[System.IO.Ports.SerialPort#01](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/cpp/serialport.cpp#01)]
[!code-csharp[System.IO.Ports.SerialPort#01](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/cs/SerialPort.cs#01)]
[!code-vb[System.IO.Ports.SerialPort#01](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/vb/SerialPort.vb#01)]
]]></format>
</remarks>
<exception cref="T:System.IO.IOException">The port is in an invalid state.
-or-
An attempt to set the state of the underlying port failed. For example, the parameters passed from this <see cref="T:System.IO.Ports.SerialPort" /> object were invalid.</exception>
</Docs>
</Member>
<Member MemberName="CtsHolding">
<MemberSignature Language="C#" Value="public bool CtsHolding { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool CtsHolding" />
<MemberSignature Language="DocId" Value="P:System.IO.Ports.SerialPort.CtsHolding" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property CtsHolding As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property bool CtsHolding { bool get(); };" />
<MemberSignature Language="F#" Value="member this.CtsHolding : bool" Usage="System.IO.Ports.SerialPort.CtsHolding" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.IO.Ports</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinmac-3.0;netframework-4.8">
<AttributeName>System.ComponentModel.Browsable(false)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinmac-3.0;netframework-4.8">
<AttributeName>System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the state of the Clear-to-Send line.</summary>
<value>
<see langword="true" /> if the Clear-to-Send line is detected; otherwise, <see langword="false" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The Clear-to-Send (CTS) line is used in Request to Send/Clear to Send (RTS/CTS) hardware handshaking. The CTS line is queried by a port before data is sent.
]]></format>
</remarks>
<exception cref="T:System.IO.IOException">The port is in an invalid state.
-or-
An attempt to set the state of the underlying port failed. For example, the parameters passed from this <see cref="T:System.IO.Ports.SerialPort" /> object were invalid.</exception>
<exception cref="T:System.InvalidOperationException">The stream is closed. This can occur because the <see cref="M:System.IO.Ports.SerialPort.Open" /> method has not been called or the <see cref="M:System.IO.Ports.SerialPort.Close" /> method has been called.</exception>
</Docs>
</Member>
<Member MemberName="DataBits">
<MemberSignature Language="C#" Value="public int DataBits { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance int32 DataBits" />
<MemberSignature Language="DocId" Value="P:System.IO.Ports.SerialPort.DataBits" />
<MemberSignature Language="VB.NET" Value="Public Property DataBits As Integer" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property int DataBits { int get(); void set(int value); };" />
<MemberSignature Language="F#" Value="member this.DataBits : int with get, set" Usage="System.IO.Ports.SerialPort.DataBits" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.IO.Ports</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinmac-3.0;netframework-4.8">
<AttributeName>System.ComponentModel.Browsable(true)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinmac-3.0;netframework-4.8">
<AttributeName>System.ComponentModel.DefaultValue(8)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="xamarinmac-3.0">
<AttributeName>System.Diagnostics.MonitoringDescription("")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>System.Diagnostics.MonitoringDescription("DataBits")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Int32</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the standard length of data bits per byte.</summary>
<value>The data bits length.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The range of values for this property is from 5 through 8. The default value is 8.
## Examples
The following code example demonstrates the use of the <xref:System.IO.Ports.SerialPort> class to allow two users to chat from two separate computers connected by a null modem cable. In this example, the users are prompted for the port settings and a username before chatting. This code example is part of a larger code example provided for the <xref:System.IO.Ports.SerialPort> class.
[!code-cpp[System.IO.Ports.SerialPort#01](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/cpp/serialport.cpp#01)]
[!code-csharp[System.IO.Ports.SerialPort#01](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/cs/SerialPort.cs#01)]
[!code-vb[System.IO.Ports.SerialPort#01](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/vb/SerialPort.vb#01)]
]]></format>
</remarks>
<exception cref="T:System.IO.IOException">The port is in an invalid state.
-or-
An attempt to set the state of the underlying port failed. For example, the parameters passed from this <see cref="T:System.IO.Ports.SerialPort" /> object were invalid.</exception>
<exception cref="T:System.ArgumentOutOfRangeException">The data bits value is less than 5 or more than 8.</exception>
</Docs>
</Member>
<Member MemberName="DataReceived">
<MemberSignature Language="C#" Value="public event System.IO.Ports.SerialDataReceivedEventHandler DataReceived;" />
<MemberSignature Language="ILAsm" Value=".event class System.IO.Ports.SerialDataReceivedEventHandler DataReceived" />
<MemberSignature Language="DocId" Value="E:System.IO.Ports.SerialPort.DataReceived" />
<MemberSignature Language="VB.NET" Value="Public Custom Event DataReceived As SerialDataReceivedEventHandler " />
<MemberSignature Language="C++ CLI" Value="public:&#xA; event System::IO::Ports::SerialDataReceivedEventHandler ^ DataReceived;" />
<MemberSignature Language="F#" Value="member this.DataReceived : System.IO.Ports.SerialDataReceivedEventHandler " Usage="member this.DataReceived : System.IO.Ports.SerialDataReceivedEventHandler " />
<MemberType>Event</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.IO.Ports</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="xamarinmac-3.0">
<AttributeName>System.Diagnostics.MonitoringDescription("")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>System.Diagnostics.MonitoringDescription("SerialDataReceived")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.IO.Ports.SerialDataReceivedEventHandler</ReturnType>
</ReturnValue>
<Docs>
<summary>Indicates that data has been received through a port represented by the <see cref="T:System.IO.Ports.SerialPort" /> object.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Data events can be caused by any of the items in the <xref:System.IO.Ports.SerialData> enumeration. Because the operating system determines whether to raise this event or not, not all parity errors may be reported.
The <xref:System.IO.Ports.SerialPort.DataReceived> event is also raised if an Eof character is received, regardless of the number of bytes in the internal input buffer and the value of the <xref:System.IO.Ports.SerialPort.ReceivedBytesThreshold%2A> property.
<xref:System.IO.Ports.SerialPort.PinChanged>, <xref:System.IO.Ports.SerialPort.DataReceived>, and <xref:System.IO.Ports.SerialPort.ErrorReceived> events may be called out of order, and there may be a slight delay between when the underlying stream reports the error and when the event handler is executed. Only one event handler can execute at a time.
The <xref:System.IO.Ports.SerialPort.DataReceived> event is not guaranteed to be raised for every byte received. Use the <xref:System.IO.Ports.SerialPort.BytesToRead%2A> property to determine how much data is left to be read in the buffer.
The <xref:System.IO.Ports.SerialPort.DataReceived> event is raised on a secondary thread when data is received from the <xref:System.IO.Ports.SerialPort> object. Because this event is raised on a secondary thread, and not the main thread, attempting to modify some elements in the main thread, such as UI elements, could raise a threading exception. If it is necessary to modify elements in the main <xref:System.Windows.Forms.Form> or <xref:System.Windows.Forms.Control>, post change requests back using <xref:System.Windows.Forms.Control.Invoke%2A>, which will do the work on the proper thread.
For more information about handling events, see [Handling and Raising Events](~/docs/standard/events/index.md).
## Examples
This example adds a <xref:System.IO.Ports.SerialDataReceivedEventHandler> to <xref:System.IO.Ports.SerialPort.DataReceived> to read all the available data received on the COM1 port. Note that to test this code it is necessary to have hardware attached to COM1 that will send data.
[!code-cpp[System.IO.Ports.SerialPort#06](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/cpp/datareceived.cpp#06)]
[!code-csharp[System.IO.Ports.SerialPort#06](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/cs/datareceived.cs#06)]
[!code-vb[System.IO.Ports.SerialPort#06](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/vb/datareceived.vb#06)]
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="DiscardInBuffer">
<MemberSignature Language="C#" Value="public void DiscardInBuffer ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void DiscardInBuffer() cil managed" />
<MemberSignature Language="DocId" Value="M:System.IO.Ports.SerialPort.DiscardInBuffer" />
<MemberSignature Language="VB.NET" Value="Public Sub DiscardInBuffer ()" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; void DiscardInBuffer();" />
<MemberSignature Language="F#" Value="member this.DiscardInBuffer : unit -&gt; unit" Usage="serialPort.DiscardInBuffer " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.IO.Ports</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Discards data from the serial driver's receive buffer.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This method is equivalent to the following Visual Basic code: `MSComm1.InBufferCount = 0`. It clears the receive buffer, but does not affect the transmit buffer.
]]></format>
</remarks>
<exception cref="T:System.IO.IOException">The port is in an invalid state.
-or-
An attempt to set the state of the underlying port failed. For example, the parameters passed from this <see cref="T:System.IO.Ports.SerialPort" /> object were invalid.</exception>
<exception cref="T:System.InvalidOperationException">The stream is closed. This can occur because the <see cref="M:System.IO.Ports.SerialPort.Open" /> method has not been called or the <see cref="M:System.IO.Ports.SerialPort.Close" /> method has been called.</exception>
</Docs>
</Member>
<Member MemberName="DiscardNull">
<MemberSignature Language="C#" Value="public bool DiscardNull { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool DiscardNull" />
<MemberSignature Language="DocId" Value="P:System.IO.Ports.SerialPort.DiscardNull" />
<MemberSignature Language="VB.NET" Value="Public Property DiscardNull As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property bool DiscardNull { bool get(); void set(bool value); };" />
<MemberSignature Language="F#" Value="member this.DiscardNull : bool with get, set" Usage="System.IO.Ports.SerialPort.DiscardNull" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.IO.Ports</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinmac-3.0;netframework-4.8">
<AttributeName>System.ComponentModel.Browsable(true)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinmac-3.0;netframework-4.8">
<AttributeName>System.ComponentModel.DefaultValue(false)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="xamarinmac-3.0">
<AttributeName>System.Diagnostics.MonitoringDescription("")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="xamarinmac-3.0">
<AttributeName>System.MonoTODO("Not implemented")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>System.Diagnostics.MonitoringDescription("DiscardNull")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets a value indicating whether null bytes are ignored when transmitted between the port and the receive buffer.</summary>
<value>
<see langword="true" /> if null bytes are ignored; otherwise <see langword="false" />. The default is <see langword="false" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This value should normally be set to `false`, especially for binary transmissions. Setting this property to `true` can cause unexpected results for UTF32- and UTF16-encoded bytes.
]]></format>
</remarks>
<exception cref="T:System.IO.IOException">The port is in an invalid state.
-or-
An attempt to set the state of the underlying port failed. For example, the parameters passed from this <see cref="T:System.IO.Ports.SerialPort" /> object were invalid.</exception>
<exception cref="T:System.InvalidOperationException">The stream is closed. This can occur because the <see cref="M:System.IO.Ports.SerialPort.Open" /> method has not been called or the <see cref="M:System.IO.Ports.SerialPort.Close" /> method has been called.</exception>
</Docs>
</Member>
<Member MemberName="DiscardOutBuffer">
<MemberSignature Language="C#" Value="public void DiscardOutBuffer ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void DiscardOutBuffer() cil managed" />
<MemberSignature Language="DocId" Value="M:System.IO.Ports.SerialPort.DiscardOutBuffer" />
<MemberSignature Language="VB.NET" Value="Public Sub DiscardOutBuffer ()" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; void DiscardOutBuffer();" />
<MemberSignature Language="F#" Value="member this.DiscardOutBuffer : unit -&gt; unit" Usage="serialPort.DiscardOutBuffer " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.IO.Ports</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Discards data from the serial driver's transmit buffer.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This method is equivalent to the following Visual Basic code: `MSComm1.OutBufferCount = 0`. It clears the transmit buffer, but does not affect the receive buffer.
]]></format>
</remarks>
<exception cref="T:System.IO.IOException">The port is in an invalid state.
-or-
An attempt to set the state of the underlying port failed. For example, the parameters passed from this <see cref="T:System.IO.Ports.SerialPort" /> object were invalid.</exception>
<exception cref="T:System.InvalidOperationException">The stream is closed. This can occur because the <see cref="M:System.IO.Ports.SerialPort.Open" /> method has not been called or the <see cref="M:System.IO.Ports.SerialPort.Close" /> method has been called.</exception>
</Docs>
</Member>
<Member MemberName="Dispose">
<MemberSignature Language="C#" Value="protected override void Dispose (bool disposing);" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig virtual instance void Dispose(bool disposing) cil managed" />
<MemberSignature Language="DocId" Value="M:System.IO.Ports.SerialPort.Dispose(System.Boolean)" />
<MemberSignature Language="VB.NET" Value="Protected Overrides Sub Dispose (disposing As Boolean)" />
<MemberSignature Language="C++ CLI" Value="protected:&#xA; override void Dispose(bool disposing);" />
<MemberSignature Language="F#" Value="override this.Dispose : bool -&gt; unit" Usage="serialPort.Dispose disposing" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.IO.Ports</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="disposing" Type="System.Boolean" />
</Parameters>
<Docs>
<param name="disposing">
<see langword="true" /> to release both managed and unmanaged resources; <see langword="false" /> to release only unmanaged resources.</param>
<summary>Releases the unmanaged resources used by the <see cref="T:System.IO.Ports.SerialPort" /> and optionally releases the managed resources.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This method is called by the public <xref:System.ComponentModel.Component.Dispose%2A> method and the <xref:System.Object.Finalize%2A> method. <xref:System.ComponentModel.Component.Dispose%2A> invokes the protected <xref:System.IO.Ports.SerialPort.Dispose%2A> method with the `disposing` parameter set to `true`. <xref:System.Object.Finalize%2A> invokes <xref:System.IO.Ports.SerialPort.Dispose%2A> with `disposing` set to `false`.
When the `disposing` parameter is `true`, this method releases all resources held by any managed objects that this <xref:System.IO.Ports.SerialPort> references. This method invokes the <xref:System.ComponentModel.Component.Dispose%2A> method of each referenced object.
This method flushes and closes the stream object in the <xref:System.IO.Ports.SerialPort.BaseStream%2A> property.
]]></format>
</remarks>
<exception cref="T:System.IO.IOException">The port is in an invalid state.
-or-
An attempt to set the state of the underlying port failed. For example, the parameters passed from this <see cref="T:System.IO.Ports.SerialPort" /> object were invalid.</exception>
<block subset="none" type="overrides">
<para>
<see cref="M:System.ComponentModel.Component.Dispose" /> can be called multiple times by other objects. When overriding <see cref="M:System.IO.Ports.SerialPort.Dispose(System.Boolean)" />, be careful not to reference objects that have been previously disposed of in an earlier call to <see cref="M:System.ComponentModel.Component.Dispose" />. For more information about how to implement <see cref="M:System.IO.Ports.SerialPort.Dispose(System.Boolean)" />, see [Implementing a Dispose Method](~/docs/standard/garbage-collection/implementing-dispose.md).
For more information about <see cref="M:System.ComponentModel.Component.Dispose" /> and <see cref="M:System.Object.Finalize" />, see [Cleaning Up Unmanaged Resources](~/docs/standard/garbage-collection/unmanaged.md).</para>
</block>
</Docs>
</Member>
<Member MemberName="DsrHolding">
<MemberSignature Language="C#" Value="public bool DsrHolding { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool DsrHolding" />
<MemberSignature Language="DocId" Value="P:System.IO.Ports.SerialPort.DsrHolding" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property DsrHolding As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property bool DsrHolding { bool get(); };" />
<MemberSignature Language="F#" Value="member this.DsrHolding : bool" Usage="System.IO.Ports.SerialPort.DsrHolding" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.IO.Ports</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinmac-3.0;netframework-4.8">
<AttributeName>System.ComponentModel.Browsable(false)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinmac-3.0;netframework-4.8">
<AttributeName>System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the state of the Data Set Ready (DSR) signal.</summary>
<value>
<see langword="true" /> if a Data Set Ready signal has been sent to the port; otherwise, <see langword="false" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This property is used in Data Set Ready/Data Terminal Ready (DSR/DTR) handshaking. The Data Set Ready (DSR) signal is usually sent by a modem to a port to indicate that it is ready for data transmission or data reception.
]]></format>
</remarks>
<exception cref="T:System.IO.IOException">The port is in an invalid state.
-or-
An attempt to set the state of the underlying port failed. For example, the parameters passed from this <see cref="T:System.IO.Ports.SerialPort" /> object were invalid.</exception>
<exception cref="T:System.InvalidOperationException">The stream is closed. This can occur because the <see cref="M:System.IO.Ports.SerialPort.Open" /> method has not been called or the <see cref="M:System.IO.Ports.SerialPort.Close" /> method has been called.</exception>
</Docs>
</Member>
<Member MemberName="DtrEnable">
<MemberSignature Language="C#" Value="public bool DtrEnable { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool DtrEnable" />
<MemberSignature Language="DocId" Value="P:System.IO.Ports.SerialPort.DtrEnable" />
<MemberSignature Language="VB.NET" Value="Public Property DtrEnable As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property bool DtrEnable { bool get(); void set(bool value); };" />
<MemberSignature Language="F#" Value="member this.DtrEnable : bool with get, set" Usage="System.IO.Ports.SerialPort.DtrEnable" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.IO.Ports</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinmac-3.0;netframework-4.8">
<AttributeName>System.ComponentModel.Browsable(true)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinmac-3.0;netframework-4.8">
<AttributeName>System.ComponentModel.DefaultValue(false)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="xamarinmac-3.0">
<AttributeName>System.Diagnostics.MonitoringDescription("")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>System.Diagnostics.MonitoringDescription("DtrEnable")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets a value that enables the Data Terminal Ready (DTR) signal during serial communication.</summary>
<value>
<see langword="true" /> to enable Data Terminal Ready (DTR); otherwise, <see langword="false" />. The default is <see langword="false" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Data Terminal Ready (DTR) is typically enabled during XON/XOFF software handshaking and Request to Send/Clear to Send (RTS/CTS) hardware handshaking, and modem communications.
]]></format>
</remarks>
<exception cref="T:System.IO.IOException">The port is in an invalid state.
-or-
An attempt to set the state of the underlying port failed. For example, the parameters passed from this <see cref="T:System.IO.Ports.SerialPort" /> object were invalid.</exception>
</Docs>
</Member>
<Member MemberName="Encoding">
<MemberSignature Language="C#" Value="public System.Text.Encoding Encoding { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Text.Encoding Encoding" />
<MemberSignature Language="DocId" Value="P:System.IO.Ports.SerialPort.Encoding" />
<MemberSignature Language="VB.NET" Value="Public Property Encoding As Encoding" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property System::Text::Encoding ^ Encoding { System::Text::Encoding ^ get(); void set(System::Text::Encoding ^ value); };" />
<MemberSignature Language="F#" Value="member this.Encoding : System.Text.Encoding with get, set" Usage="System.IO.Ports.SerialPort.Encoding" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.IO.Ports</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinmac-3.0;netframework-4.8">
<AttributeName>System.ComponentModel.Browsable(false)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinmac-3.0;netframework-4.8">
<AttributeName>System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="xamarinmac-3.0">
<AttributeName>System.Diagnostics.MonitoringDescription("")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>System.Diagnostics.MonitoringDescription("Encoding")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Text.Encoding</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the byte encoding for pre- and post-transmission conversion of text.</summary>
<value>An <see cref="T:System.Text.Encoding" /> object. The default is <see cref="T:System.Text.ASCIIEncoding" />.</value>
<remarks>To be added.</remarks>
<exception cref="T:System.ArgumentNullException">The <see cref="P:System.IO.Ports.SerialPort.Encoding" /> property was set to <see langword="null" />.</exception>
<exception cref="T:System.ArgumentException">The <see cref="P:System.IO.Ports.SerialPort.Encoding" /> property was set to an encoding that is not <see cref="T:System.Text.ASCIIEncoding" />, <see cref="T:System.Text.UTF8Encoding" />, <see cref="T:System.Text.UTF32Encoding" />, <see cref="T:System.Text.UnicodeEncoding" />, one of the Windows single byte encodings, or one of the Windows double byte encodings.</exception>
</Docs>
</Member>
<Member MemberName="ErrorReceived">
<MemberSignature Language="C#" Value="public event System.IO.Ports.SerialErrorReceivedEventHandler ErrorReceived;" />
<MemberSignature Language="ILAsm" Value=".event class System.IO.Ports.SerialErrorReceivedEventHandler ErrorReceived" />
<MemberSignature Language="DocId" Value="E:System.IO.Ports.SerialPort.ErrorReceived" />
<MemberSignature Language="VB.NET" Value="Public Custom Event ErrorReceived As SerialErrorReceivedEventHandler " />
<MemberSignature Language="C++ CLI" Value="public:&#xA; event System::IO::Ports::SerialErrorReceivedEventHandler ^ ErrorReceived;" />
<MemberSignature Language="F#" Value="member this.ErrorReceived : System.IO.Ports.SerialErrorReceivedEventHandler " Usage="member this.ErrorReceived : System.IO.Ports.SerialErrorReceivedEventHandler " />
<MemberType>Event</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.IO.Ports</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="xamarinmac-3.0">
<AttributeName>System.Diagnostics.MonitoringDescription("")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>System.Diagnostics.MonitoringDescription("SerialErrorReceived")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.IO.Ports.SerialErrorReceivedEventHandler</ReturnType>
</ReturnValue>
<Docs>
<summary>Indicates that an error has occurred with a port represented by a <see cref="T:System.IO.Ports.SerialPort" /> object.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Error events can be caused by any of the items in the <xref:System.IO.Ports.SerialError> enumeration. Because the operating system determines whether to raise this event or not, not all parity errors may be reported.
<xref:System.IO.Ports.SerialPort.PinChanged>, <xref:System.IO.Ports.SerialPort.DataReceived>, and <xref:System.IO.Ports.SerialPort.ErrorReceived> events may be called out of order, and there may be a slight delay between when the underlying stream reports the error and when code can when the event handler is executed. Only one event handler can execute at a time.
If a parity error occurs on the trailing byte of a stream, an extra byte will be added to the input buffer with a value of 126.
The <xref:System.IO.Ports.SerialPort.ErrorReceived> event is raised on a secondary thread when an error is received from the <xref:System.IO.Ports.SerialPort> object. Because this event is raised on a secondary thread, and not the main thread, attempting to modify some elements in the main thread, such as UI elements, could raise a threading exception. If it is necessary to modify elements in the main <xref:System.Windows.Forms.Form> or <xref:System.Windows.Forms.Control>, post change requests back using <xref:System.Windows.Forms.Control.Invoke%2A>, which will do the work on the proper thread.
For more information about handling events, see [Handling and Raising Events](~/docs/standard/events/index.md).
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="GetPortNames">
<MemberSignature Language="C#" Value="public static string[] GetPortNames ();" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig string[] GetPortNames() cil managed" />
<MemberSignature Language="DocId" Value="M:System.IO.Ports.SerialPort.GetPortNames" />
<MemberSignature Language="VB.NET" Value="Public Shared Function GetPortNames () As String()" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; static cli::array &lt;System::String ^&gt; ^ GetPortNames();" />
<MemberSignature Language="F#" Value="static member GetPortNames : unit -&gt; string[]" Usage="System.IO.Ports.SerialPort.GetPortNames " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.IO.Ports</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.String[]</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Gets an array of serial port names for the current computer.</summary>
<returns>An array of serial port names for the current computer.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The order of port names returned from <xref:System.IO.Ports.SerialPort.GetPortNames%2A> is not specified.
Use the <xref:System.IO.Ports.SerialPort.GetPortNames%2A> method to query the current computer for a list of valid serial port names. For example, you can use this method to determine whether COM1 and COM2 are valid serial ports for the current computer.
The port names are obtained from the system registry (for example, HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM). If the registry contains stale or otherwise incorrect data then the <xref:System.IO.Ports.SerialPort.GetPortNames%2A> method will return incorrect data.
## Examples
The following code example uses the <xref:System.IO.Ports.SerialPort.GetPortNames%2A> method to display serial port names to the console.
[!code-cpp[IO.Ports.GetPortNames#1](~/samples/snippets/cpp/VS_Snippets_CLR/IO.Ports.GetPortNames/cpp/example.cpp#1)]
[!code-csharp[IO.Ports.GetPortNames#1](~/samples/snippets/csharp/VS_Snippets_CLR/IO.Ports.GetPortNames/CS/example.cs#1)]
[!code-vb[IO.Ports.GetPortNames#1](~/samples/snippets/visualbasic/VS_Snippets_CLR/IO.Ports.GetPortNames/VB/example.vb#1)]
]]></format>
</remarks>
<exception cref="T:System.ComponentModel.Win32Exception">The serial port names could not be queried.</exception>
</Docs>
</Member>
<Member MemberName="Handshake">
<MemberSignature Language="C#" Value="public System.IO.Ports.Handshake Handshake { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance valuetype System.IO.Ports.Handshake Handshake" />
<MemberSignature Language="DocId" Value="P:System.IO.Ports.SerialPort.Handshake" />
<MemberSignature Language="VB.NET" Value="Public Property Handshake As Handshake" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property System::IO::Ports::Handshake Handshake { System::IO::Ports::Handshake get(); void set(System::IO::Ports::Handshake value); };" />
<MemberSignature Language="F#" Value="member this.Handshake : System.IO.Ports.Handshake with get, set" Usage="System.IO.Ports.SerialPort.Handshake" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.IO.Ports</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinmac-3.0;netframework-4.8">
<AttributeName>System.ComponentModel.Browsable(true)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinmac-3.0;netframework-4.8">
<AttributeName>System.ComponentModel.DefaultValue(Mono.Cecil.CustomAttributeArgument)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="xamarinmac-3.0">
<AttributeName>System.Diagnostics.MonitoringDescription("")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>System.Diagnostics.MonitoringDescription("Handshake")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.IO.Ports.Handshake</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the handshaking protocol for serial port transmission of data using a value from <see cref="T:System.IO.Ports.Handshake" />.</summary>
<value>One of the <see cref="T:System.IO.Ports.Handshake" /> values. The default is <see langword="None" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
When handshaking is used, the device connected to the <xref:System.IO.Ports.SerialPort> object is instructed to stop sending data when there is at least (<xref:System.IO.Ports.SerialPort.ReadBufferSize%2A>-1024) bytes in the buffer. The device is instructed to start sending data again when there are 1024 or fewer bytes in the buffer. If the device is sending data in blocks that are larger than 1024 bytes, this may cause the buffer to overflow.
If the <xref:System.IO.Ports.SerialPort.Handshake%2A> property is set to <xref:System.IO.Ports.Handshake.RequestToSendXOnXOff> and <xref:System.IO.Ports.SerialPort.CtsHolding%2A> is set to `false`, the XOff character will not be sent. If <xref:System.IO.Ports.SerialPort.CtsHolding%2A> is then set to `true`, more data must be sent before the XOff character will be sent.
## Examples
The following code example demonstrates the use of the <xref:System.IO.Ports.SerialPort> class to allow two users to chat from two separate computers connected by a null modem cable. In this example, the users are prompted for the port settings and a username before chatting. This code example is part of a larger code example provided for the <xref:System.IO.Ports.SerialPort> class.
[!code-cpp[System.IO.Ports.SerialPort#01](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/cpp/serialport.cpp#01)]
[!code-csharp[System.IO.Ports.SerialPort#01](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/cs/SerialPort.cs#01)]
[!code-vb[System.IO.Ports.SerialPort#01](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/vb/SerialPort.vb#01)]
]]></format>
</remarks>
<exception cref="T:System.IO.IOException">The port is in an invalid state.
-or-
An attempt to set the state of the underlying port failed. For example, the parameters passed from this <see cref="T:System.IO.Ports.SerialPort" /> object were invalid.</exception>
<exception cref="T:System.ArgumentOutOfRangeException">The value passed is not a valid value in the <see cref="T:System.IO.Ports.Handshake" /> enumeration.</exception>
</Docs>
</Member>
<Member MemberName="InfiniteTimeout">
<MemberSignature Language="C#" Value="public const int InfiniteTimeout = -1;" />
<MemberSignature Language="ILAsm" Value=".field public static literal int32 InfiniteTimeout = (-1)" />
<MemberSignature Language="DocId" Value="F:System.IO.Ports.SerialPort.InfiniteTimeout" />
<MemberSignature Language="VB.NET" Value="Public Const InfiniteTimeout As Integer = -1" />
<MemberSignature Language="C++ CLI" Value="public: int InfiniteTimeout = -1;" />
<MemberSignature Language="F#" Value="val mutable InfiniteTimeout : int" Usage="System.IO.Ports.SerialPort.InfiniteTimeout" />
<MemberType>Field</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.IO.Ports</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Int32</ReturnType>
</ReturnValue>
<MemberValue>-1</MemberValue>
<Docs>
<summary>Indicates that no time-out should occur.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This value is used with the <xref:System.IO.Ports.SerialPort.ReadTimeout%2A> and <xref:System.IO.Ports.SerialPort.WriteTimeout%2A> properties.
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="IsOpen">
<MemberSignature Language="C#" Value="public bool IsOpen { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool IsOpen" />
<MemberSignature Language="DocId" Value="P:System.IO.Ports.SerialPort.IsOpen" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property IsOpen As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property bool IsOpen { bool get(); };" />
<MemberSignature Language="F#" Value="member this.IsOpen : bool" Usage="System.IO.Ports.SerialPort.IsOpen" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.IO.Ports</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinmac-3.0;netframework-4.8">
<AttributeName>System.ComponentModel.Browsable(false)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets a value indicating the open or closed status of the <see cref="T:System.IO.Ports.SerialPort" /> object.</summary>
<value>
<see langword="true" /> if the serial port is open; otherwise, <see langword="false" />. The default is <see langword="false" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.IO.Ports.SerialPort.IsOpen%2A> property tracks whether the port is open for use by the caller, not whether the port is open by any application on the machine.
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">The <see cref="P:System.IO.Ports.SerialPort.IsOpen" /> value passed is <see langword="null" />.</exception>
<exception cref="T:System.ArgumentException">The <see cref="P:System.IO.Ports.SerialPort.IsOpen" /> value passed is an empty string ("").</exception>
</Docs>
</Member>
<Member MemberName="NewLine">
<MemberSignature Language="C#" Value="public string NewLine { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance string NewLine" />
<MemberSignature Language="DocId" Value="P:System.IO.Ports.SerialPort.NewLine" />
<MemberSignature Language="VB.NET" Value="Public Property NewLine As String" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property System::String ^ NewLine { System::String ^ get(); void set(System::String ^ value); };" />
<MemberSignature Language="F#" Value="member this.NewLine : string with get, set" Usage="System.IO.Ports.SerialPort.NewLine" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.IO.Ports</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinmac-3.0;netframework-4.8">
<AttributeName>System.ComponentModel.Browsable(false)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinmac-3.0;netframework-4.8">
<AttributeName>System.ComponentModel.DefaultValue("\n")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="xamarinmac-3.0">
<AttributeName>System.Diagnostics.MonitoringDescription("")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>System.Diagnostics.MonitoringDescription("NewLine")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the value used to interpret the end of a call to the <see cref="M:System.IO.Ports.SerialPort.ReadLine" /> and <see cref="M:System.IO.Ports.SerialPort.WriteLine(System.String)" /> methods.</summary>
<value>A value that represents the end of a line. The default is a line feed ("\n" in C# or <see cref="F:Microsoft.VisualBasic.Constants.vbLf" /> in Visual Basic).</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This property determines what value (byte) defines the end of a line for the <xref:System.IO.Ports.SerialPort.ReadLine%2A> and <xref:System.IO.Ports.SerialPort.WriteLine%2A> methods. By default the end-of-line value is a line feed character (`\n` in C#, <xref:Microsoft.VisualBasic.Constants.vbLf?displayProperty=nameWithType> in Visual Basic). You would change this to a different value if the particular serial device you're working with uses a different value for the same purpose.
]]></format>
</remarks>
<exception cref="T:System.ArgumentException">The property value is empty.</exception>
<exception cref="T:System.ArgumentNullException">The property value is <see langword="null" />.</exception>
</Docs>
</Member>
<Member MemberName="Open">
<MemberSignature Language="C#" Value="public void Open ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void Open() cil managed" />
<MemberSignature Language="DocId" Value="M:System.IO.Ports.SerialPort.Open" />
<MemberSignature Language="VB.NET" Value="Public Sub Open ()" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; void Open();" />
<MemberSignature Language="F#" Value="member this.Open : unit -&gt; unit" Usage="serialPort.Open " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.IO.Ports</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Opens a new serial port connection.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Only one open connection can exist per <xref:System.IO.Ports.SerialPort> object.
The best practice for any application is to wait for some amount of time after calling the <xref:System.IO.Ports.SerialPort.Close%2A> method before attempting to call the <xref:System.IO.Ports.SerialPort.Open%2A> method, as the port may not be closed instantly.
## Examples
The following code example demonstrates the use of the <xref:System.IO.Ports.SerialPort> class to allow two users to chat from two separate computers connected by a null modem cable. In this example, the users are prompted for the port settings and a username before chatting. This code example is part of a larger code example provided for the <xref:System.IO.Ports.SerialPort> class.
[!code-cpp[System.IO.Ports.SerialPort#01](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/cpp/serialport.cpp#01)]
[!code-csharp[System.IO.Ports.SerialPort#01](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/cs/SerialPort.cs#01)]
[!code-vb[System.IO.Ports.SerialPort#01](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/vb/SerialPort.vb#01)]
]]></format>
</remarks>
<exception cref="T:System.UnauthorizedAccessException">Access is denied to the port.
-or-
The current process, or another process on the system, already has the specified COM port open either by a <see cref="T:System.IO.Ports.SerialPort" /> instance or in unmanaged code.</exception>
<exception cref="T:System.ArgumentOutOfRangeException">One or more of the properties for this instance are invalid. For example, the <see cref="P:System.IO.Ports.SerialPort.Parity" />, <see cref="P:System.IO.Ports.SerialPort.DataBits" />, or <see cref="P:System.IO.Ports.SerialPort.Handshake" /> properties are not valid values; the <see cref="P:System.IO.Ports.SerialPort.BaudRate" /> is less than or equal to zero; the <see cref="P:System.IO.Ports.SerialPort.ReadTimeout" /> or <see cref="P:System.IO.Ports.SerialPort.WriteTimeout" /> property is less than zero and is not <see cref="F:System.IO.Ports.SerialPort.InfiniteTimeout" />.</exception>
<exception cref="T:System.ArgumentException">The port name does not begin with "COM".
-or-
The file type of the port is not supported.</exception>
<exception cref="T:System.IO.IOException">The port is in an invalid state.
-or-
An attempt to set the state of the underlying port failed. For example, the parameters passed from this <see cref="T:System.IO.Ports.SerialPort" /> object were invalid.</exception>
<exception cref="T:System.InvalidOperationException">The specified port on the current instance of the <see cref="T:System.IO.Ports.SerialPort" /> is already open.</exception>
<permission cref="T:System.Security.Permissions.SecurityPermission">for calling unmanaged code. Associated enumeration: <see cref="F:System.Security.Permissions.SecurityPermissionFlag.UnmanagedCode" /> Security action: <see cref="F:System.Security.Permissions.SecurityAction.LinkDemand" /></permission>
</Docs>
</Member>
<Member MemberName="Parity">
<MemberSignature Language="C#" Value="public System.IO.Ports.Parity Parity { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance valuetype System.IO.Ports.Parity Parity" />
<MemberSignature Language="DocId" Value="P:System.IO.Ports.SerialPort.Parity" />
<MemberSignature Language="VB.NET" Value="Public Property Parity As Parity" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property System::IO::Ports::Parity Parity { System::IO::Ports::Parity get(); void set(System::IO::Ports::Parity value); };" />
<MemberSignature Language="F#" Value="member this.Parity : System.IO.Ports.Parity with get, set" Usage="System.IO.Ports.SerialPort.Parity" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.IO.Ports</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinmac-3.0;netframework-4.8">
<AttributeName>System.ComponentModel.Browsable(true)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinmac-3.0;netframework-4.8">
<AttributeName>System.ComponentModel.DefaultValue(Mono.Cecil.CustomAttributeArgument)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="xamarinmac-3.0">
<AttributeName>System.Diagnostics.MonitoringDescription("")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>System.Diagnostics.MonitoringDescription("Parity")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.IO.Ports.Parity</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the parity-checking protocol.</summary>
<value>One of the enumeration values that represents the parity-checking protocol. The default is <see cref="F:System.IO.Ports.Parity.None" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
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.
If a parity error occurs on the trailing byte of a stream, an extra byte will be added to the input buffer with a value of 126.
## Examples
The following code example demonstrates the use of the <xref:System.IO.Ports.SerialPort> class to allow two users to chat from two separate computers connected by a null modem cable. In this example, the users are prompted for the port settings and a username before chatting. This code example is part of a larger code example provided for the <xref:System.IO.Ports.SerialPort> class.
[!code-cpp[System.IO.Ports.SerialPort#01](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/cpp/serialport.cpp#01)]
[!code-csharp[System.IO.Ports.SerialPort#01](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/cs/SerialPort.cs#01)]
[!code-vb[System.IO.Ports.SerialPort#01](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/vb/SerialPort.vb#01)]
]]></format>
</remarks>
<exception cref="T:System.IO.IOException">The port is in an invalid state.
-or-
An attempt to set the state of the underlying port failed. For example, the parameters passed from this <see cref="T:System.IO.Ports.SerialPort" /> object were invalid.</exception>
<exception cref="T:System.ArgumentOutOfRangeException">The <see cref="P:System.IO.Ports.SerialPort.Parity" /> value passed is not a valid value in the <see cref="T:System.IO.Ports.Parity" /> enumeration.</exception>
</Docs>
</Member>
<Member MemberName="ParityReplace">
<MemberSignature Language="C#" Value="public byte ParityReplace { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance unsigned int8 ParityReplace" />
<MemberSignature Language="DocId" Value="P:System.IO.Ports.SerialPort.ParityReplace" />
<MemberSignature Language="VB.NET" Value="Public Property ParityReplace As Byte" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property System::Byte ParityReplace { System::Byte get(); void set(System::Byte value); };" />
<MemberSignature Language="F#" Value="member this.ParityReplace : byte with get, set" Usage="System.IO.Ports.SerialPort.ParityReplace" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.IO.Ports</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinmac-3.0;netframework-4.8">
<AttributeName>System.ComponentModel.Browsable(true)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinmac-3.0;netframework-4.8">
<AttributeName>System.ComponentModel.DefaultValue(63)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="xamarinmac-3.0">
<AttributeName>System.Diagnostics.MonitoringDescription("")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="xamarinmac-3.0">
<AttributeName>System.MonoTODO("Not implemented")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>System.Diagnostics.MonitoringDescription("ParityReplace")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Byte</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the byte that replaces invalid bytes in a data stream when a parity error occurs.</summary>
<value>A byte that replaces invalid bytes.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
If the value is set to the null character, parity replacement is disabled.
]]></format>
</remarks>
<exception cref="T:System.IO.IOException">The port is in an invalid state.
-or-
An attempt to set the state of the underlying port failed. For example, the parameters passed from this <see cref="T:System.IO.Ports.SerialPort" /> object were invalid.</exception>
</Docs>
</Member>
<Member MemberName="PinChanged">
<MemberSignature Language="C#" Value="public event System.IO.Ports.SerialPinChangedEventHandler PinChanged;" />
<MemberSignature Language="ILAsm" Value=".event class System.IO.Ports.SerialPinChangedEventHandler PinChanged" />
<MemberSignature Language="DocId" Value="E:System.IO.Ports.SerialPort.PinChanged" />
<MemberSignature Language="VB.NET" Value="Public Custom Event PinChanged As SerialPinChangedEventHandler " />
<MemberSignature Language="C++ CLI" Value="public:&#xA; event System::IO::Ports::SerialPinChangedEventHandler ^ PinChanged;" />
<MemberSignature Language="F#" Value="member this.PinChanged : System.IO.Ports.SerialPinChangedEventHandler " Usage="member this.PinChanged : System.IO.Ports.SerialPinChangedEventHandler " />
<MemberType>Event</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.IO.Ports</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="xamarinmac-3.0">
<AttributeName>System.Diagnostics.MonitoringDescription("")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>System.Diagnostics.MonitoringDescription("SerialPinChanged")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.IO.Ports.SerialPinChangedEventHandler</ReturnType>
</ReturnValue>
<Docs>
<summary>Indicates that a non-data signal event has occurred on the port represented by the <see cref="T:System.IO.Ports.SerialPort" /> object.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Serial pin changed events can be caused by any of the items in the <xref:System.IO.Ports.SerialPinChange> enumeration. Because the operating system determines whether to raise this event or not, not all parity errors may be reported. As part of the event, the new value of the pin is set.
The <xref:System.IO.Ports.SerialPort.PinChanged> event is raised when a <xref:System.IO.Ports.SerialPort> object enters the <xref:System.IO.Ports.SerialPort.BreakState%2A>, but not when the port exits the <xref:System.IO.Ports.SerialPort.BreakState%2A>. This behavior does not apply to other values in the <xref:System.IO.Ports.SerialPinChange> enumeration.
<xref:System.IO.Ports.SerialPort.PinChanged>, <xref:System.IO.Ports.SerialPort.DataReceived>, and <xref:System.IO.Ports.SerialPort.ErrorReceived> events may be called out of order, and there may be a slight delay between when the underlying stream reports the error and when the event handler is executed. Only one event handler can execute at a time.
The <xref:System.IO.Ports.SerialPort.PinChanged> event is raised on a secondary thread. Because this event is raised on a secondary thread, and not the main thread, attempting to modify some elements in the main thread, such as UI elements, could raise a threading exception. If it is necessary to modify elements in the main <xref:System.Windows.Forms.Form> or <xref:System.Windows.Forms.Control>, post change requests back using <xref:System.Windows.Forms.Control.Invoke%2A>, which will do the work on the proper thread.
For more information about handling events, see [Handling and Raising Events](~/docs/standard/events/index.md).
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="PortName">
<MemberSignature Language="C#" Value="public string PortName { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance string PortName" />
<MemberSignature Language="DocId" Value="P:System.IO.Ports.SerialPort.PortName" />
<MemberSignature Language="VB.NET" Value="Public Property PortName As String" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property System::String ^ PortName { System::String ^ get(); void set(System::String ^ value); };" />
<MemberSignature Language="F#" Value="member this.PortName : string with get, set" Usage="System.IO.Ports.SerialPort.PortName" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.IO.Ports</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinmac-3.0;netframework-4.8">
<AttributeName>System.ComponentModel.Browsable(true)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinmac-3.0;netframework-4.8">
<AttributeName>System.ComponentModel.DefaultValue("COM1")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="xamarinmac-3.0">
<AttributeName>System.Diagnostics.MonitoringDescription("")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>System.Diagnostics.MonitoringDescription("PortName")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the port for communications, including but not limited to all available COM ports.</summary>
<value>The communications port. The default is COM1.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
A list of valid port names can be obtained using the <xref:System.IO.Ports.SerialPort.GetPortNames%2A> method.
## Examples
The following code example demonstrates the use of the <xref:System.IO.Ports.SerialPort> class to allow two users to chat from two separate computers connected by a null modem cable. In this example, the users are prompted for the port settings and a username before chatting. This code example is part of a larger code example provided for the <xref:System.IO.Ports.SerialPort> class.
[!code-cpp[System.IO.Ports.SerialPort#01](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/cpp/serialport.cpp#01)]
[!code-csharp[System.IO.Ports.SerialPort#01](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/cs/SerialPort.cs#01)]
[!code-vb[System.IO.Ports.SerialPort#01](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/vb/SerialPort.vb#01)]
]]></format>
</remarks>
<exception cref="T:System.ArgumentException">The <see cref="P:System.IO.Ports.SerialPort.PortName" /> property was set to a value with a length of zero.
-or-
The <see cref="P:System.IO.Ports.SerialPort.PortName" /> property was set to a value that starts with "\\\\".
-or-
The port name was not valid.</exception>
<exception cref="T:System.ArgumentNullException">The <see cref="P:System.IO.Ports.SerialPort.PortName" /> property was set to <see langword="null" />.</exception>
<exception cref="T:System.InvalidOperationException">The specified port is open.</exception>
</Docs>
</Member>
<MemberGroup MemberName="Read">
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Reads from the <see cref="T:System.IO.Ports.SerialPort" /> input buffer.</summary>
</Docs>
</MemberGroup>
<Member MemberName="Read">
<MemberSignature Language="C#" Value="public int Read (byte[] buffer, int offset, int count);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance int32 Read(unsigned int8[] buffer, int32 offset, int32 count) cil managed" />
<MemberSignature Language="DocId" Value="M:System.IO.Ports.SerialPort.Read(System.Byte[],System.Int32,System.Int32)" />
<MemberSignature Language="VB.NET" Value="Public Function Read (buffer As Byte(), offset As Integer, count As Integer) As Integer" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; int Read(cli::array &lt;System::Byte&gt; ^ buffer, int offset, int count);" />
<MemberSignature Language="F#" Value="member this.Read : byte[] * int * int -&gt; int" Usage="serialPort.Read (buffer, offset, count)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.IO.Ports</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Int32</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="buffer" Type="System.Byte[]" />
<Parameter Name="offset" Type="System.Int32" />
<Parameter Name="count" Type="System.Int32" />
</Parameters>
<Docs>
<param name="buffer">The byte array to write the input to.</param>
<param name="offset">The offset in <paramref name="buffer" /> at which to write the bytes.</param>
<param name="count">The maximum number of bytes to read. Fewer bytes are read if <paramref name="count" /> is greater than the number of bytes in the input buffer.</param>
<summary>Reads a number of bytes from the <see cref="T:System.IO.Ports.SerialPort" /> input buffer and writes those bytes into a byte array at the specified offset.</summary>
<returns>The number of bytes read.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
If it is necessary to switch between reading text and reading binary data from the stream, select a protocol that carefully defines the boundary between text and binary data, such as manually reading bytes and decoding the data.
Because the <xref:System.IO.Ports.SerialPort> class buffers data, and the stream contained in the <xref:System.IO.Ports.SerialPort.BaseStream%2A> property does not, the two might conflict about how many bytes are available to read. The <xref:System.IO.Ports.SerialPort.BytesToRead%2A> property can indicate that there are bytes to read, but these bytes might not be accessible to the stream contained in the <xref:System.IO.Ports.SerialPort.BaseStream%2A> property because they have been buffered to the <xref:System.IO.Ports.SerialPort> class.
The <xref:System.IO.Ports.SerialPort.Read%2A> method does not block other operations when the number of bytes read equals `count` but there are still unread bytes available on the serial port.
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">The buffer passed is <see langword="null" />.</exception>
<exception cref="T:System.InvalidOperationException">The specified port is not open.</exception>
<exception cref="T:System.ArgumentOutOfRangeException">The <paramref name="offset" /> or <paramref name="count" /> parameters are outside a valid region of the <paramref name="buffer" /> being passed. Either <paramref name="offset" /> or <paramref name="count" /> is less than zero.</exception>
<exception cref="T:System.ArgumentException">
<paramref name="offset" /> plus <paramref name="count" /> is greater than the length of the <paramref name="buffer" />.</exception>
<exception cref="T:System.TimeoutException">No bytes were available to read.</exception>
</Docs>
</Member>
<Member MemberName="Read">
<MemberSignature Language="C#" Value="public int Read (char[] buffer, int offset, int count);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance int32 Read(char[] buffer, int32 offset, int32 count) cil managed" />
<MemberSignature Language="DocId" Value="M:System.IO.Ports.SerialPort.Read(System.Char[],System.Int32,System.Int32)" />
<MemberSignature Language="VB.NET" Value="Public Function Read (buffer As Char(), offset As Integer, count As Integer) As Integer" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; int Read(cli::array &lt;char&gt; ^ buffer, int offset, int count);" />
<MemberSignature Language="F#" Value="member this.Read : char[] * int * int -&gt; int" Usage="serialPort.Read (buffer, offset, count)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.IO.Ports</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Int32</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="buffer" Type="System.Char[]" />
<Parameter Name="offset" Type="System.Int32" />
<Parameter Name="count" Type="System.Int32" />
</Parameters>
<Docs>
<param name="buffer">The character array to write the input to.</param>
<param name="offset">The offset in <paramref name="buffer" /> at which to write the characters.</param>
<param name="count">The maximum number of characters to read. Fewer characters are read if <paramref name="count" /> is greater than the number of characters in the input buffer.</param>
<summary>Reads a number of characters from the <see cref="T:System.IO.Ports.SerialPort" /> input buffer and writes them into an array of characters at a given offset.</summary>
<returns>The number of characters read.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use this method for reading characters from the serial port.
If it is necessary to switch between reading text and reading binary data from the stream, select a protocol that carefully defines the boundary between text and binary data, such as manually reading bytes and decoding the data.
Because the <xref:System.IO.Ports.SerialPort> class buffers data, and the stream contained in the <xref:System.IO.Ports.SerialPort.BaseStream%2A> property does not, the two might conflict about how many characters are available to read. The <xref:System.IO.Ports.SerialPort.BytesToRead%2A> property can indicate that there are characters to read, but these characters might not be accessible to the stream contained in the <xref:System.IO.Ports.SerialPort.BaseStream%2A> property because they have been buffered to the <xref:System.IO.Ports.SerialPort> class.
The <xref:System.IO.Ports.SerialPort.Read%2A> method does not block other operations when the number of bytes read equals `count` but there are still unread bytes available on the serial port.
]]></format>
</remarks>
<exception cref="T:System.ArgumentException">
<paramref name="offset" /> plus <paramref name="count" /> is greater than the length of the buffer.
-or-
<paramref name="count" /> is 1 and there is a surrogate character in the buffer.</exception>
<exception cref="T:System.ArgumentNullException">The <paramref name="buffer" /> passed is <see langword="null" />.</exception>
<exception cref="T:System.ArgumentOutOfRangeException">The <paramref name="offset" /> or <paramref name="count" /> parameters are outside a valid region of the <paramref name="buffer" /> being passed. Either <paramref name="offset" /> or <paramref name="count" /> is less than zero.</exception>
<exception cref="T:System.InvalidOperationException">The specified port is not open.</exception>
<exception cref="T:System.TimeoutException">No characters were available to read.</exception>
</Docs>
</Member>
<Member MemberName="ReadBufferSize">
<MemberSignature Language="C#" Value="public int ReadBufferSize { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance int32 ReadBufferSize" />
<MemberSignature Language="DocId" Value="P:System.IO.Ports.SerialPort.ReadBufferSize" />
<MemberSignature Language="VB.NET" Value="Public Property ReadBufferSize As Integer" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property int ReadBufferSize { int get(); void set(int value); };" />
<MemberSignature Language="F#" Value="member this.ReadBufferSize : int with get, set" Usage="System.IO.Ports.SerialPort.ReadBufferSize" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.IO.Ports</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinmac-3.0;netframework-4.8">
<AttributeName>System.ComponentModel.Browsable(true)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinmac-3.0;netframework-4.8">
<AttributeName>System.ComponentModel.DefaultValue(4096)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="xamarinmac-3.0">
<AttributeName>System.Diagnostics.MonitoringDescription("")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>System.Diagnostics.MonitoringDescription("ReadBufferSize")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Int32</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the size of the <see cref="T:System.IO.Ports.SerialPort" /> input buffer.</summary>
<value>The buffer size, in bytes. The default value is 4096; the maximum value is that of a positive int, or 2147483647.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.IO.Ports.SerialPort.ReadBufferSize%2A> property ignores any value smaller than 4096.
Because the <xref:System.IO.Ports.SerialPort.ReadBufferSize%2A> property represents only the Windows-created buffer, it can return a smaller value than the <xref:System.IO.Ports.SerialPort.BytesToRead%2A> property, which represents both the <xref:System.IO.Ports.SerialPort> buffer and the Windows-created buffer.
]]></format>
</remarks>
<exception cref="T:System.ArgumentOutOfRangeException">The <see cref="P:System.IO.Ports.SerialPort.ReadBufferSize" /> value set is less than or equal to zero.</exception>
<exception cref="T:System.InvalidOperationException">The <see cref="P:System.IO.Ports.SerialPort.ReadBufferSize" /> property was set while the stream was open.</exception>
<exception cref="T:System.IO.IOException">The <see cref="P:System.IO.Ports.SerialPort.ReadBufferSize" /> property was set to an odd integer value.</exception>
</Docs>
</Member>
<Member MemberName="ReadByte">
<MemberSignature Language="C#" Value="public int ReadByte ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance int32 ReadByte() cil managed" />
<MemberSignature Language="DocId" Value="M:System.IO.Ports.SerialPort.ReadByte" />
<MemberSignature Language="VB.NET" Value="Public Function ReadByte () As Integer" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; int ReadByte();" />
<MemberSignature Language="F#" Value="member this.ReadByte : unit -&gt; int" Usage="serialPort.ReadByte " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.IO.Ports</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Int32</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Synchronously reads one byte from the <see cref="T:System.IO.Ports.SerialPort" /> input buffer.</summary>
<returns>The byte, cast to an <see cref="T:System.Int32" />, or -1 if the end of the stream has been read.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This method reads one byte.
Use caution when using <xref:System.IO.Ports.SerialPort.ReadByte%2A> and <xref:System.IO.Ports.SerialPort.ReadChar%2A> together. Switching between reading bytes and reading characters can cause extra data to be read and/or other unintended behavior. If it is necessary to switch between reading text and reading binary data from the stream, select a protocol that carefully defines the boundary between text and binary data, such as manually reading bytes and decoding the data.
> [!NOTE]
> Because the <xref:System.IO.Ports.SerialPort> class buffers data, and the stream contained in the <xref:System.IO.Ports.SerialPort.BaseStream%2A> property does not, the two might conflict about how many bytes are available to read. The <xref:System.IO.Ports.SerialPort.BytesToRead%2A> property can indicate that there are bytes to read, but these bytes might not be accessible to the stream contained in the <xref:System.IO.Ports.SerialPort.BaseStream%2A> property because they have been buffered to the <xref:System.IO.Ports.SerialPort> class.
]]></format>
</remarks>
<exception cref="T:System.InvalidOperationException">The specified port is not open.</exception>
<exception cref="T:System.ServiceProcess.TimeoutException">The operation did not complete before the time-out period ended.
-or-
No byte was read.</exception>
</Docs>
</Member>
<Member MemberName="ReadChar">
<MemberSignature Language="C#" Value="public int ReadChar ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance int32 ReadChar() cil managed" />
<MemberSignature Language="DocId" Value="M:System.IO.Ports.SerialPort.ReadChar" />
<MemberSignature Language="VB.NET" Value="Public Function ReadChar () As Integer" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; int ReadChar();" />
<MemberSignature Language="F#" Value="member this.ReadChar : unit -&gt; int" Usage="serialPort.ReadChar " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.IO.Ports</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Int32</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Synchronously reads one character from the <see cref="T:System.IO.Ports.SerialPort" /> input buffer.</summary>
<returns>The character that was read.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This method reads one complete character based on the encoding.
Use caution when using <xref:System.IO.Ports.SerialPort.ReadByte%2A> and <xref:System.IO.Ports.SerialPort.ReadChar%2A> together. Switching between reading bytes and reading characters can cause extra data to be read and/or other unintended behavior. If it is necessary to switch between reading text and reading binary data from the stream, select a protocol that carefully defines the boundary between text and binary data, such as manually reading bytes and decoding the data.
> [!NOTE]
> Because the <xref:System.IO.Ports.SerialPort> class buffers data, and the stream contained in the <xref:System.IO.Ports.SerialPort.BaseStream%2A> property does not, the two might conflict about how many bytes are available to read. The <xref:System.IO.Ports.SerialPort.BytesToRead%2A> property can indicate that there are bytes to read, but these bytes might not be accessible to the stream contained in the <xref:System.IO.Ports.SerialPort.BaseStream%2A> property because they have been buffered to the <xref:System.IO.Ports.SerialPort> class.
]]></format>
</remarks>
<exception cref="T:System.InvalidOperationException">The specified port is not open.</exception>
<exception cref="T:System.ServiceProcess.TimeoutException">The operation did not complete before the time-out period ended.
-or-
No character was available in the allotted time-out period.</exception>
</Docs>
</Member>
<Member MemberName="ReadExisting">
<MemberSignature Language="C#" Value="public string ReadExisting ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance string ReadExisting() cil managed" />
<MemberSignature Language="DocId" Value="M:System.IO.Ports.SerialPort.ReadExisting" />
<MemberSignature Language="VB.NET" Value="Public Function ReadExisting () As String" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; System::String ^ ReadExisting();" />
<MemberSignature Language="F#" Value="member this.ReadExisting : unit -&gt; string" Usage="serialPort.ReadExisting " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.IO.Ports</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Reads all immediately available bytes, based on the encoding, in both the stream and the input buffer of the <see cref="T:System.IO.Ports.SerialPort" /> object.</summary>
<returns>The contents of the stream and the input buffer of the <see cref="T:System.IO.Ports.SerialPort" /> object.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This method returns the contents of the stream and internal buffer of the <xref:System.IO.Ports.SerialPort> object as a string. This method does not use a time-out. Note that this method can leave trailing lead bytes in the internal buffer, which makes the <xref:System.IO.Ports.SerialPort.BytesToRead%2A> value greater than zero.
If it is necessary to switch between reading text and reading binary data from the stream, select a protocol that carefully defines the boundary between text and binary data, such as manually reading bytes and decoding the data.
> [!NOTE]
> The <xref:System.IO.Ports.SerialPort> class buffers data, but the stream object contained in the <xref:System.IO.Ports.SerialPort.BaseStream%2A?displayProperty=nameWithType> property does not. Therefore, the <xref:System.IO.Ports.SerialPort> object and the stream object might differ on the number of bytes that are available to read. When bytes are buffered to the <xref:System.IO.Ports.SerialPort> object, the <xref:System.IO.Ports.SerialPort.BytesToRead%2A> property includes these bytes in its value; however, these bytes might not be accessible to the stream contained in the <xref:System.IO.Ports.SerialPort.BaseStream%2A> property.
]]></format>
</remarks>
<exception cref="T:System.InvalidOperationException">The specified port is not open.</exception>
</Docs>
</Member>
<Member MemberName="ReadLine">
<MemberSignature Language="C#" Value="public string ReadLine ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance string ReadLine() cil managed" />
<MemberSignature Language="DocId" Value="M:System.IO.Ports.SerialPort.ReadLine" />
<MemberSignature Language="VB.NET" Value="Public Function ReadLine () As String" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; System::String ^ ReadLine();" />
<MemberSignature Language="F#" Value="member this.ReadLine : unit -&gt; string" Usage="serialPort.ReadLine " />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.IO.Ports</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Reads up to the <see cref="P:System.IO.Ports.SerialPort.NewLine" /> value in the input buffer.</summary>
<returns>The contents of the input buffer up to the first occurrence of a <see cref="P:System.IO.Ports.SerialPort.NewLine" /> value.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Note that while this method does not return the <xref:System.IO.Ports.SerialPort.NewLine%2A> value, the <xref:System.IO.Ports.SerialPort.NewLine%2A> value is removed from the input buffer.
By default, the <xref:System.IO.Ports.SerialPort.ReadLine%2A> method will block until a line is received. If this behavior is undesirable, set the <xref:System.IO.Ports.SerialPort.ReadTimeout%2A> property to any non-zero value to force the <xref:System.IO.Ports.SerialPort.ReadLine%2A> method to throw a <xref:System.TimeoutException> if a line is not available on the port.
If it is necessary to switch between reading text and reading binary data from the stream, select a protocol that carefully defines the boundary between text and binary data, such as manually reading bytes and decoding the data.
> [!NOTE]
> Because the <xref:System.IO.Ports.SerialPort> class buffers data, and the stream contained in the <xref:System.IO.Ports.SerialPort.BaseStream%2A> property does not, the two might conflict about how many bytes are available to read. The <xref:System.IO.Ports.SerialPort.BytesToRead%2A> property can indicate that there are bytes to read, but these bytes might not be accessible to the stream contained in the <xref:System.IO.Ports.SerialPort.BaseStream%2A> property because they have been buffered to the <xref:System.IO.Ports.SerialPort> class.
## Examples
The following code example demonstrates the use of the <xref:System.IO.Ports.SerialPort> class to allow two users to chat from two separate computers connected by a null modem cable. This code example is part of a larger code example provided for the <xref:System.IO.Ports.SerialPort> class.
[!code-cpp[System.IO.Ports.SerialPort#01](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/cpp/serialport.cpp#01)]
[!code-csharp[System.IO.Ports.SerialPort#01](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/cs/SerialPort.cs#01)]
[!code-vb[System.IO.Ports.SerialPort#01](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/vb/SerialPort.vb#01)]
]]></format>
</remarks>
<exception cref="T:System.InvalidOperationException">The specified port is not open.</exception>
<exception cref="T:System.TimeoutException">The operation did not complete before the time-out period ended.
-or-
No bytes were read.</exception>
</Docs>
</Member>
<Member MemberName="ReadTimeout">
<MemberSignature Language="C#" Value="public int ReadTimeout { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance int32 ReadTimeout" />
<MemberSignature Language="DocId" Value="P:System.IO.Ports.SerialPort.ReadTimeout" />
<MemberSignature Language="VB.NET" Value="Public Property ReadTimeout As Integer" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property int ReadTimeout { int get(); void set(int value); };" />
<MemberSignature Language="F#" Value="member this.ReadTimeout : int with get, set" Usage="System.IO.Ports.SerialPort.ReadTimeout" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.IO.Ports</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinmac-3.0;netframework-4.8">
<AttributeName>System.ComponentModel.Browsable(true)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinmac-3.0;netframework-4.8">
<AttributeName>System.ComponentModel.DefaultValue(-1)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="xamarinmac-3.0">
<AttributeName>System.Diagnostics.MonitoringDescription("")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>System.Diagnostics.MonitoringDescription("ReadTimeout")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Int32</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the number of milliseconds before a time-out occurs when a read operation does not finish.</summary>
<value>The number of milliseconds before a time-out occurs when a read operation does not finish.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The read time-out value was originally set at 500 milliseconds in the Win32 Communications API. This property allows you to set this value. The time-out can be set to any value greater than zero, or set to <xref:System.IO.Ports.SerialPort.InfiniteTimeout>, in which case no time-out occurs. <xref:System.IO.Ports.SerialPort.InfiniteTimeout> is the default.
> [!NOTE]
> Users of the unmanaged `COMMTIMEOUTS` structure might expect to set the time-out value to zero to suppress time-outs. To suppress time-outs with the <xref:System.IO.Ports.SerialPort.ReadTimeout%2A> property, however, you must specify <xref:System.IO.Ports.SerialPort.InfiniteTimeout>.
This property does not affect the <xref:System.IO.Stream.BeginRead%2A> method of the stream returned by the <xref:System.IO.Ports.SerialPort.BaseStream%2A> property.
## Examples
The following code example demonstrates the use of the <xref:System.IO.Ports.SerialPort> class to allow two users to chat from two separate computers connected by a null modem cable. In this example, the users are prompted for the port settings and a username before chatting. This code example is part of a larger code example provided for the <xref:System.IO.Ports.SerialPort> class.
[!code-cpp[System.IO.Ports.SerialPort#01](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/cpp/serialport.cpp#01)]
[!code-csharp[System.IO.Ports.SerialPort#01](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/cs/SerialPort.cs#01)]
[!code-vb[System.IO.Ports.SerialPort#01](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/vb/SerialPort.vb#01)]
]]></format>
</remarks>
<exception cref="T:System.IO.IOException">The port is in an invalid state.
-or-
An attempt to set the state of the underlying port failed. For example, the parameters passed from this <see cref="T:System.IO.Ports.SerialPort" /> object were invalid.</exception>
<exception cref="T:System.ArgumentOutOfRangeException">The read time-out value is less than zero and not equal to <see cref="F:System.IO.Ports.SerialPort.InfiniteTimeout" />.</exception>
</Docs>
</Member>
<Member MemberName="ReadTo">
<MemberSignature Language="C#" Value="public string ReadTo (string value);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance string ReadTo(string value) cil managed" />
<MemberSignature Language="DocId" Value="M:System.IO.Ports.SerialPort.ReadTo(System.String)" />
<MemberSignature Language="VB.NET" Value="Public Function ReadTo (value As String) As String" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; System::String ^ ReadTo(System::String ^ value);" />
<MemberSignature Language="F#" Value="member this.ReadTo : string -&gt; string" Usage="serialPort.ReadTo value" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.IO.Ports</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="value" Type="System.String" />
</Parameters>
<Docs>
<param name="value">A value that indicates where the read operation stops.</param>
<summary>Reads a string up to the specified <paramref name="value" /> in the input buffer.</summary>
<returns>The contents of the input buffer up to the specified <paramref name="value" />.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This method reads a string up to the specified `value`. While the returned string does not include the `value`, the `value` is removed from the input buffer.
If it is necessary to switch between reading text and reading binary data from the stream, select a protocol that carefully defines the boundary between text and binary data, such as manually reading bytes and decoding the data.
> [!NOTE]
> Because the <xref:System.IO.Ports.SerialPort> class buffers data, and the stream contained in the <xref:System.IO.Ports.SerialPort.BaseStream%2A> property does not, the two might conflict about how many bytes are available to read. The <xref:System.IO.Ports.SerialPort.BytesToRead%2A> property can indicate that there are bytes to read, but these bytes might not be accessible to the stream contained in the <xref:System.IO.Ports.SerialPort.BaseStream%2A> property because they have been buffered to the <xref:System.IO.Ports.SerialPort> class.
]]></format>
</remarks>
<exception cref="T:System.ArgumentException">The length of the <paramref name="value" /> parameter is 0.</exception>
<exception cref="T:System.ArgumentNullException">The <paramref name="value" /> parameter is <see langword="null" />.</exception>
<exception cref="T:System.InvalidOperationException">The specified port is not open.</exception>
<exception cref="T:System.TimeoutException">The operation did not complete before the time-out period ended.</exception>
</Docs>
</Member>
<Member MemberName="ReceivedBytesThreshold">
<MemberSignature Language="C#" Value="public int ReceivedBytesThreshold { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance int32 ReceivedBytesThreshold" />
<MemberSignature Language="DocId" Value="P:System.IO.Ports.SerialPort.ReceivedBytesThreshold" />
<MemberSignature Language="VB.NET" Value="Public Property ReceivedBytesThreshold As Integer" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property int ReceivedBytesThreshold { int get(); void set(int value); };" />
<MemberSignature Language="F#" Value="member this.ReceivedBytesThreshold : int with get, set" Usage="System.IO.Ports.SerialPort.ReceivedBytesThreshold" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.IO.Ports</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinmac-3.0;netframework-4.8">
<AttributeName>System.ComponentModel.Browsable(true)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinmac-3.0;netframework-4.8">
<AttributeName>System.ComponentModel.DefaultValue(1)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="xamarinmac-3.0">
<AttributeName>System.Diagnostics.MonitoringDescription("")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="xamarinmac-3.0">
<AttributeName>System.MonoTODO("Not implemented")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>System.Diagnostics.MonitoringDescription("ReceivedBytesThreshold")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Int32</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the number of bytes in the internal input buffer before a <see cref="E:System.IO.Ports.SerialPort.DataReceived" /> event occurs.</summary>
<value>The number of bytes in the internal input buffer before a <see cref="E:System.IO.Ports.SerialPort.DataReceived" /> event is fired. The default is 1.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.IO.Ports.SerialPort.DataReceived> event is also raised if an <xref:System.IO.Ports.SerialData.Eof> character is received, regardless of the number of bytes in the internal input buffer and the value of the <xref:System.IO.Ports.SerialPort.ReceivedBytesThreshold%2A> property.
]]></format>
</remarks>
<exception cref="T:System.ArgumentOutOfRangeException">The <see cref="P:System.IO.Ports.SerialPort.ReceivedBytesThreshold" /> value is less than or equal to zero.</exception>
</Docs>
</Member>
<Member MemberName="RtsEnable">
<MemberSignature Language="C#" Value="public bool RtsEnable { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool RtsEnable" />
<MemberSignature Language="DocId" Value="P:System.IO.Ports.SerialPort.RtsEnable" />
<MemberSignature Language="VB.NET" Value="Public Property RtsEnable As Boolean" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property bool RtsEnable { bool get(); void set(bool value); };" />
<MemberSignature Language="F#" Value="member this.RtsEnable : bool with get, set" Usage="System.IO.Ports.SerialPort.RtsEnable" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.IO.Ports</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinmac-3.0;netframework-4.8">
<AttributeName>System.ComponentModel.Browsable(true)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinmac-3.0;netframework-4.8">
<AttributeName>System.ComponentModel.DefaultValue(false)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="xamarinmac-3.0">
<AttributeName>System.Diagnostics.MonitoringDescription("")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>System.Diagnostics.MonitoringDescription("RtsEnable")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets a value indicating whether the Request to Send (RTS) signal is enabled during serial communication.</summary>
<value>
<see langword="true" /> to enable Request to Transmit (RTS); otherwise, <see langword="false" />. The default is <see langword="false" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The Request to Transmit (RTS) signal is typically used in Request to Send/Clear to Send (RTS/CTS) hardware handshaking.
]]></format>
</remarks>
<exception cref="T:System.InvalidOperationException">The value of the <see cref="P:System.IO.Ports.SerialPort.RtsEnable" /> property was set or retrieved while the <see cref="P:System.IO.Ports.SerialPort.Handshake" /> property is set to the <see cref="F:System.IO.Ports.Handshake.RequestToSend" /> value or the <see cref="F:System.IO.Ports.Handshake.RequestToSendXOnXOff" /> value.</exception>
<exception cref="T:System.IO.IOException">The port is in an invalid state.
-or-
An attempt to set the state of the underlying port failed. For example, the parameters passed from this <see cref="T:System.IO.Ports.SerialPort" /> object were invalid.</exception>
</Docs>
</Member>
<Member MemberName="StopBits">
<MemberSignature Language="C#" Value="public System.IO.Ports.StopBits StopBits { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance valuetype System.IO.Ports.StopBits StopBits" />
<MemberSignature Language="DocId" Value="P:System.IO.Ports.SerialPort.StopBits" />
<MemberSignature Language="VB.NET" Value="Public Property StopBits As StopBits" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property System::IO::Ports::StopBits StopBits { System::IO::Ports::StopBits get(); void set(System::IO::Ports::StopBits value); };" />
<MemberSignature Language="F#" Value="member this.StopBits : System.IO.Ports.StopBits with get, set" Usage="System.IO.Ports.SerialPort.StopBits" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.IO.Ports</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinmac-3.0;netframework-4.8">
<AttributeName>System.ComponentModel.Browsable(true)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinmac-3.0;netframework-4.8">
<AttributeName>System.ComponentModel.DefaultValue(Mono.Cecil.CustomAttributeArgument)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="xamarinmac-3.0">
<AttributeName>System.Diagnostics.MonitoringDescription("")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>System.Diagnostics.MonitoringDescription("StopBits")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.IO.Ports.StopBits</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the standard number of stopbits per byte.</summary>
<value>One of the <see cref="T:System.IO.Ports.StopBits" /> values.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The default value for <xref:System.IO.Ports.SerialPort.StopBits%2A> is <xref:System.IO.Ports.StopBits.One>.
The <xref:System.IO.Ports.StopBits.None?displayProperty=nameWithType> value is not supported.
## Examples
The following example shows how to set the <xref:System.IO.Ports.SerialPort.StopBits%2A> property to `One`.
[!code-cpp[System.IO.Ports.SerialPort#20](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/cpp/datareceived.cpp#20)]
[!code-csharp[System.IO.Ports.SerialPort#20](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/cs/datareceived.cs#20)]
[!code-vb[System.IO.Ports.SerialPort#20](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/vb/datareceived.vb#20)]
The following example demonstrates the use of the <xref:System.IO.Ports.SerialPort> class to allow two users to chat from two separate computers connected by a null modem cable. In this example, the users are prompted for the port settings and a username before chatting. This code example is part of a larger example provided for the <xref:System.IO.Ports.SerialPort> class.
[!code-cpp[System.IO.Ports.SerialPort#01](~/samples/snippets/cpp/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/cpp/serialport.cpp#01)]
[!code-csharp[System.IO.Ports.SerialPort#01](~/samples/snippets/csharp/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/cs/SerialPort.cs#01)]
[!code-vb[System.IO.Ports.SerialPort#01](~/samples/snippets/visualbasic/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/vb/SerialPort.vb#01)]
]]></format>
</remarks>
<exception cref="T:System.ArgumentOutOfRangeException">The <see cref="P:System.IO.Ports.SerialPort.StopBits" /> value is <see cref="F:System.IO.Ports.StopBits.None" />.</exception>
<exception cref="T:System.IO.IOException">The port is in an invalid state.
-or-
An attempt to set the state of the underlying port failed. For example, the parameters passed from this <see cref="T:System.IO.Ports.SerialPort" /> object were invalid.</exception>
</Docs>
</Member>
<MemberGroup MemberName="Write">
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Writes data to the serial port output buffer.</summary>
</Docs>
</MemberGroup>
<Member MemberName="Write">
<MemberSignature Language="C#" Value="public void Write (string text);" FrameworkAlternate="netcore-2.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netcore-2.1;netframework-4.8;dotnet-plat-ext-2.1;netcore-2.2;netcore-3.0;dotnet-plat-ext-2.2;dotnet-plat-ext-3.0" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void Write(string text) cil managed" FrameworkAlternate="netcore-2.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netcore-2.1;netframework-4.8;dotnet-plat-ext-2.1;netcore-2.2;netcore-3.0;dotnet-plat-ext-2.2;dotnet-plat-ext-3.0" />
<MemberSignature Language="VB.NET" Value="Public Sub Write (text As String)" FrameworkAlternate="netcore-2.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netcore-2.1;netframework-4.8;dotnet-plat-ext-2.1;netcore-2.2;netcore-3.0;dotnet-plat-ext-2.2;dotnet-plat-ext-3.0" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; void Write(System::String ^ text);" FrameworkAlternate="netcore-2.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netcore-2.1;netframework-4.8;dotnet-plat-ext-2.1;netcore-2.2;netcore-3.0;dotnet-plat-ext-2.2;dotnet-plat-ext-3.0" />
<MemberSignature Language="C#" Value="public void Write (string str);" FrameworkAlternate="xamarinmac-3.0" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void Write(string str) cil managed" FrameworkAlternate="xamarinmac-3.0" />
<MemberSignature Language="VB.NET" Value="Public Sub Write (str As String)" FrameworkAlternate="xamarinmac-3.0" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; void Write(System::String ^ str);" FrameworkAlternate="xamarinmac-3.0" />
<MemberSignature Language="DocId" Value="M:System.IO.Ports.SerialPort.Write(System.String)" FrameworkAlternate="xamarinmac-3.0" />
<MemberSignature Language="F#" Value="member this.Write : string -&gt; unit" Usage="serialPort.Write str" FrameworkAlternate="xamarinmac-3.0" />
<MemberSignature Language="DocId" Value="M:System.IO.Ports.SerialPort.Write(System.String)" FrameworkAlternate="xamarinmac-3.0" />
<MemberSignature Language="F#" Value="member this.Write : string -&gt; unit" Usage="serialPort.Write str" FrameworkAlternate="xamarinmac-3.0" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.IO.Ports</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="text" Type="System.String" Index="0" FrameworkAlternate="dotnet-plat-ext-2.1;dotnet-plat-ext-2.2;dotnet-plat-ext-3.0;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8" />
<Parameter Name="str" Type="System.String" Index="0" FrameworkAlternate="xamarinmac-3.0" />
</Parameters>
<Docs>
<param name="text">The string for output.</param>
<param name="str">To be added.</param>
<summary>Writes the specified string to the serial port.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use this method when you want to write a string as output to a serial port.
If there are too many bytes in the output buffer and <xref:System.IO.Ports.SerialPort.Handshake%2A> is set to <xref:System.IO.Ports.Handshake.XOnXOff> then the <xref:System.IO.Ports.SerialPort> object may raise a <xref:System.ServiceProcess.TimeoutException> while it waits for the device to be ready to accept more data.
By default, <xref:System.IO.Ports.SerialPort> uses <xref:System.Text.ASCIIEncoding> to encode the characters. <xref:System.Text.ASCIIEncoding> encodes all characters greater than 127 as (char)63 or '?'. To support additional characters in that range, set <xref:System.IO.Ports.SerialPort.Encoding%2A> to <xref:System.Text.UTF8Encoding>, <xref:System.Text.UTF32Encoding>, or <xref:System.Text.UnicodeEncoding>.
]]></format>
</remarks>
<exception cref="T:System.InvalidOperationException">The specified port is not open.</exception>
<exception cref="T:System.ArgumentNullException">
<paramref name="text" /> is <see langword="null" />.</exception>
<exception cref="T:System.ServiceProcess.TimeoutException">The operation did not complete before the time-out period ended.</exception>
</Docs>
</Member>
<Member MemberName="Write">
<MemberSignature Language="C#" Value="public void Write (byte[] buffer, int offset, int count);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void Write(unsigned int8[] buffer, int32 offset, int32 count) cil managed" />
<MemberSignature Language="DocId" Value="M:System.IO.Ports.SerialPort.Write(System.Byte[],System.Int32,System.Int32)" />
<MemberSignature Language="VB.NET" Value="Public Sub Write (buffer As Byte(), offset As Integer, count As Integer)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; void Write(cli::array &lt;System::Byte&gt; ^ buffer, int offset, int count);" />
<MemberSignature Language="F#" Value="member this.Write : byte[] * int * int -&gt; unit" Usage="serialPort.Write (buffer, offset, count)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.IO.Ports</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="buffer" Type="System.Byte[]" />
<Parameter Name="offset" Type="System.Int32" />
<Parameter Name="count" Type="System.Int32" />
</Parameters>
<Docs>
<param name="buffer">The byte array that contains the data to write to the port.</param>
<param name="offset">The zero-based byte offset in the <paramref name="buffer" /> parameter at which to begin copying bytes to the port.</param>
<param name="count">The number of bytes to write.</param>
<summary>Writes a specified number of bytes to the serial port using data from a buffer.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use this method when you want to write to a byte buffer to create output to a serial port.
If there are too many bytes in the output buffer and <xref:System.IO.Ports.SerialPort.Handshake%2A> is set to <xref:System.IO.Ports.Handshake.XOnXOff> then the <xref:System.IO.Ports.SerialPort> object may raise a <xref:System.ServiceProcess.TimeoutException> while it waits for the device to be ready to accept more data.
By default, <xref:System.IO.Ports.SerialPort> uses <xref:System.Text.ASCIIEncoding> to encode the characters. <xref:System.Text.ASCIIEncoding> encodes all characters greater than 127 as (char)63 or '?'. To support additional characters in that range, set <xref:System.IO.Ports.SerialPort.Encoding%2A> to <xref:System.Text.UTF8Encoding>, <xref:System.Text.UTF32Encoding>, or <xref:System.Text.UnicodeEncoding>.
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">The <paramref name="buffer" /> passed is <see langword="null" />.</exception>
<exception cref="T:System.InvalidOperationException">The specified port is not open.</exception>
<exception cref="T:System.ArgumentOutOfRangeException">The <paramref name="offset" /> or <paramref name="count" /> parameters are outside a valid region of the <paramref name="buffer" /> being passed. Either <paramref name="offset" /> or <paramref name="count" /> is less than zero.</exception>
<exception cref="T:System.ArgumentException">
<paramref name="offset" /> plus <paramref name="count" /> is greater than the length of the <paramref name="buffer" />.</exception>
<exception cref="T:System.ServiceProcess.TimeoutException">The operation did not complete before the time-out period ended.</exception>
</Docs>
</Member>
<Member MemberName="Write">
<MemberSignature Language="C#" Value="public void Write (char[] buffer, int offset, int count);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void Write(char[] buffer, int32 offset, int32 count) cil managed" />
<MemberSignature Language="DocId" Value="M:System.IO.Ports.SerialPort.Write(System.Char[],System.Int32,System.Int32)" />
<MemberSignature Language="VB.NET" Value="Public Sub Write (buffer As Char(), offset As Integer, count As Integer)" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; void Write(cli::array &lt;char&gt; ^ buffer, int offset, int count);" />
<MemberSignature Language="F#" Value="member this.Write : char[] * int * int -&gt; unit" Usage="serialPort.Write (buffer, offset, count)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.IO.Ports</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="buffer" Type="System.Char[]" />
<Parameter Name="offset" Type="System.Int32" />
<Parameter Name="count" Type="System.Int32" />
</Parameters>
<Docs>
<param name="buffer">The character array that contains the data to write to the port.</param>
<param name="offset">The zero-based byte offset in the <paramref name="buffer" /> parameter at which to begin copying bytes to the port.</param>
<param name="count">The number of characters to write.</param>
<summary>Writes a specified number of characters to the serial port using data from a buffer.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use this method when you want to write to a character buffer to create output to a serial port.
If there are too many bytes in the output buffer and <xref:System.IO.Ports.SerialPort.Handshake%2A> is set to <xref:System.IO.Ports.Handshake.XOnXOff> then the <xref:System.IO.Ports.SerialPort> object may raise a <xref:System.ServiceProcess.TimeoutException> while it waits for the device to be ready to accept more data.
By default, <xref:System.IO.Ports.SerialPort> uses <xref:System.Text.ASCIIEncoding> to encode the characters. <xref:System.Text.ASCIIEncoding> encodes all characters greater than 127 as (char)63 or '?'. To support additional characters in that range, set <xref:System.IO.Ports.SerialPort.Encoding%2A> to <xref:System.Text.UTF8Encoding>, <xref:System.Text.UTF32Encoding>, or <xref:System.Text.UnicodeEncoding>.
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">The <paramref name="buffer" /> passed is <see langword="null" />.</exception>
<exception cref="T:System.InvalidOperationException">The specified port is not open.</exception>
<exception cref="T:System.ArgumentOutOfRangeException">The <paramref name="offset" /> or <paramref name="count" /> parameters are outside a valid region of the <paramref name="buffer" /> being passed. Either <paramref name="offset" /> or <paramref name="count" /> is less than zero.</exception>
<exception cref="T:System.ArgumentException">
<paramref name="offset" /> plus <paramref name="count" /> is greater than the length of the <paramref name="buffer" />.</exception>
<exception cref="T:System.ServiceProcess.TimeoutException">The operation did not complete before the time-out period ended.</exception>
</Docs>
</Member>
<Member MemberName="WriteBufferSize">
<MemberSignature Language="C#" Value="public int WriteBufferSize { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance int32 WriteBufferSize" />
<MemberSignature Language="DocId" Value="P:System.IO.Ports.SerialPort.WriteBufferSize" />
<MemberSignature Language="VB.NET" Value="Public Property WriteBufferSize As Integer" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; property int WriteBufferSize { int get(); void set(int value); };" />
<MemberSignature Language="F#" Value="member this.WriteBufferSize : int with get, set" Usage="System.IO.Ports.SerialPort.WriteBufferSize" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.IO.Ports</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinmac-3.0;netframework-4.8">
<AttributeName>System.ComponentModel.Browsable(true)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;xamarinmac-3.0;netframework-4.8">
<AttributeName>System.ComponentModel.DefaultValue(2048)</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="xamarinmac-3.0">
<AttributeName>System.Diagnostics.MonitoringDescription("")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8">
<AttributeName>System.Diagnostics.MonitoringDescription("WriteBufferSize")</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName>get: System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Int32</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets or sets the size of the serial port output buffer.</summary>
<value>The size of the output buffer. The default is 2048.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.IO.Ports.SerialPort.WriteBufferSize%2A> property ignores any value smaller than 2048.
]]></format>
</remarks>
<exception cref="T:System.ArgumentOutOfRangeException">The <see cref="P:System.IO.Ports.SerialPort.WriteBufferSize" /> value is less than or equal to zero.</exception>
<exception cref="T:System.InvalidOperationException">The <see cref="P:System.IO.Ports.SerialPort.WriteBufferSize" /> property was set while the stream was open.</exception>
<exception cref="T:System.IO.IOException">The <see cref="P:System.IO.Ports.SerialPort.WriteBufferSize" /> property was set to an odd integer value.</exception>
</Docs>
</Member>
<Member MemberName="WriteLine">
<MemberSignature Language="C#" Value="public void WriteLine (string text);" FrameworkAlternate="netcore-2.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netcore-2.1;netframework-4.8;dotnet-plat-ext-2.1;netcore-2.2;netcore-3.0;dotnet-plat-ext-2.2;dotnet-plat-ext-3.0" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void WriteLine(string text) cil managed" FrameworkAlternate="netcore-2.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netcore-2.1;netframework-4.8;dotnet-plat-ext-2.1;netcore-2.2;netcore-3.0;dotnet-plat-ext-2.2;dotnet-plat-ext-3.0" />
<MemberSignature Language="VB.NET" Value="Public Sub WriteLine (text As String)" FrameworkAlternate="netcore-2.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netcore-2.1;netframework-4.8;dotnet-plat-ext-2.1;netcore-2.2;netcore-3.0;dotnet-plat-ext-2.2;dotnet-plat-ext-3.0" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; void WriteLine(System::String ^ text);" FrameworkAlternate="netcore-2.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netcore-2.1;netframework-4.8;dotnet-plat-ext-2.1;netcore-2.2;netcore-3.0;dotnet-plat-ext-2.2;dotnet-plat-ext-3.0" />
<MemberSignature Language="C#" Value="public void WriteLine (string str);" FrameworkAlternate="xamarinmac-3.0" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void WriteLine(string str) cil managed" FrameworkAlternate="xamarinmac-3.0" />
<MemberSignature Language="VB.NET" Value="Public Sub WriteLine (str As String)" FrameworkAlternate="xamarinmac-3.0" />
<MemberSignature Language="C++ CLI" Value="public:&#xA; void WriteLine(System::String ^ str);" FrameworkAlternate="xamarinmac-3.0" />
<MemberSignature Language="DocId" Value="M:System.IO.Ports.SerialPort.WriteLine(System.String)" FrameworkAlternate="xamarinmac-3.0" />
<MemberSignature Language="F#" Value="member this.WriteLine : string -&gt; unit" Usage="serialPort.WriteLine str" FrameworkAlternate="xamarinmac-3.0" />
<MemberSignature Language="DocId" Value="M:System.IO.Ports.SerialPort.WriteLine(System.String)" FrameworkAlternate="xamarinmac-3.0" />
<MemberSignature Language="F#" Value="member this.WriteLine : string -&gt; unit" Usage="serialPort.WriteLine str" FrameworkAlternate="xamarinmac-3.0" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<AssemblyInfo>
<AssemblyName>System.IO.Ports</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="text" Type="System.String" Index="0" FrameworkAlternate="dotnet-plat-ext-2.1;dotnet-plat-ext-2.2;dotnet-plat-ext-3.0;netcore-2.0;netcore-2.1;netcore-2.2;netcore-3.0;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8" />
<Parameter Name="str" Type="System.String" Index="0" FrameworkAlternate="xamarinmac-3.0" />
</Parameters>
<Docs>
<param name="text">The string to write to the output buffer.</param>
<param name="str">To be added.</param>
<summary>Writes the specified string and the <see cref="P:System.IO.Ports.SerialPort.NewLine" /> value to the output buffer.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks