My program needs to read any type of file from a given directory path and it has to write that information into a byte array.
string combine = Path.Combine(precombine, filename);
string content = System.IO.File.ReadAllText(combine);
This way I can read a text file however I have to read all kind of files such as music or image and write them into a byte array.
Use the File.ReadAllBytes
method
byte[] fileContent = System.IO.File.ReadAllBytes(combine);