1private byte[] StreamFile(string filename)
2 {
3 FileStream fileStream = new FileStream(filename, FileMode.Open, FileAccess.Read);
4
5 // Create a byte array of file stream length
6 byte[] fileData = new byte[fileStream.Length];
7
8 //Read block of bytes from stream into the byte array
9 fileStream.Read(fileData, 0, System.Convert.ToInt32(fileStream.Length));
10
11 //Close the File Stream
12 fileStream.Close();
13
14 return fileData; //return the byte data
15 }