BinaryReader reads in a binary file. With the BinaryReader type, we read in each integer, byte, string or other value from a binary file. This type allows us to encode our data in the most efficient way. It is also easy to use.
Thus The BinaryWriter and BinaryReader types are used together for perfect compatibility.
VB.NET program that uses BinaryReader
' Create the reader in a Using statement.
' ... Use File.Open to open the existing binary file.
Using reader As New BinaryReader(File.Open("file.bin", FileMode.Open))
' Loop through length of file.
Dim pos As Integer = 0
Dim length As Integer = reader.BaseStream.Length
While pos < length
' Read the integer.
Dim value As Integer = reader.ReadInt32()
' Write to screen.
' Add length of integer in bytes to position.
pos += 4
Also, the BinaryReader can read many kinds of data from a file. It handles Strings, with ReadString. It handles many numeric types, not just Integers. These include Double and Long.
Summary. The BinaryReader type is exceedingly useful. It loads binary data in specific file formats into a VB.NET program. This website uses BinaryReader to load all of its data when it starts up.
Also Because it is based on streams, it uses somewhat less memory as well. It does not need to load an entire file in at once.