راستی کد تبدیل فایل من به byte[] به شکل زیره :
public static byte[] Generate_Byte_File(string filePath)
{
byte[] fByte = null;
FileInfo fInfo = new FileInfo(filePath);
long numBytes = fInfo.Length;
FileStream fStream = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.None);
BinaryReader bReader = new BinaryReader(fStream);
fByte = bReader.ReadBytes(Convert.ToInt32(numBytes));
bReader.Close();
fStream.Close();
return fByte;
}
در ضمنفایل رو به صورت معمولی ثبت می کنم یعنی با command و parameters.add .