It’s easy to read a file into a byte array.  Just use the File.ReadAllBytes static method.  This opens a binary file in read-only mode, reads the contents of the file into a byte array, and then closes the file.

string filePath = @"C:\test.doc";
byte[] byteArray = File.ReadAllBytes( filePath );

Popularity: 4% [?]

Related posts:

  1. C# Read Text File Line-by-Line
  2. C# Convert Byte Array to String
  3. Convert String to Byte Array
  4. C# Read Text File into String
  5. Sort C# Array in Descending/Reverse Order