Question: how to convert text file to byte array in c#?
Answer: using (FileStream fs = new FileStream(filename, FileMode.Open, FileAccess.Read))
{
// Create a byte array of file stream length.
byte[] bytes = System.IO.File.ReadAllBytes(filename);
//Read block of bytes from stream into the byte array.