System.IO.Ports.SerialPort.BaseStream Property

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

Syntax

[System.ComponentModel.Browsable(false)]
[System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
public System.IO.Stream BaseStream { get; }

Value

Documentation for this section has not yet been entered.

Remarks

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.

Requirements

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