System.IO.Ports.SerialPort.BaseStream Property

Gets the underlying System.IO.Stream object for a System.IO.Ports.SerialPort object.


public System.IO.Stream BaseStream { get; }


Documentation for this section has not yet been entered.


Use this property for explicit asynchronous I/O operations or to pass the System.IO.Ports.SerialPort object to a System.IO.Stream wrapper class such as System.IO.StreamWriter.

Any open serial port's SerialPort.BaseStream property returns an object that derives from the abstract System.IO.Stream class, and implements read and write methods using the prototypes inherited from the System.IO.Stream class: System.IO.Stream.BeginRead(Byte[], int, int, AsyncCallback, object), System.IO.Stream.BeginWrite(Byte[], int, int, AsyncCallback, object), System.IO.Stream.Read(Byte[], int, int), System.IO.Stream.ReadByte, System.IO.Stream.Write(Byte[], int, int), and System.IO.Stream.WriteByte(byte). These methods can be useful when passing a wrapped serial resource to a System.IO.Stream wrapper class.

Due to the inaccessibility of the wrapped file handle, the System.IO.Stream.Length and System.IO.Stream.Position properties are not supported, and the System.IO.Stream.Seek(long, System.IO.SeekOrigin) and System.IO.Stream.SetLength(long) methods are not supported.


Namespace: System.IO.Ports
Assembly: System (in System.dll)
Assembly Versions:,
Since: .NET 2.0