To read a file into a bytearray in C# and VB.NET you can use the following snippet.

Sample C#

var bytes = System.IO.File.ReadAllBytes(fileName);

Sample VB.NET

Dim bytes = System.IO.File.ReadAllBytes(fileName)

One thought on “How to read a file into a bytearray in C# and VB.NET”

Leave a Reply