BinaryReader.ReadInt16 Method

Definition

Reads a 2-byte signed integer from the current stream and advances the current position of the stream by two bytes.

public:
 virtual short ReadInt16();
public virtual short ReadInt16 ();
abstract member ReadInt16 : unit -> int16
override this.ReadInt16 : unit -> int16
Public Overridable Function ReadInt16 () As Short

Returns

A 2-byte signed integer read from the current stream.

Exceptions

The end of the stream is reached.

The stream is closed.

An I/O error occurred.

Remarks

BinaryReader does not restore the file position after an unsuccessful read.

BinaryReader reads this data type in little-endian format.

For a list of common I/O tasks, see Common I/O Tasks.

Applies to

See also