/// <summary>
/// 将文件转换为二进制串
/// </summary>
/// <param name="filePath">文件的路径</param>
/// <returns></returns>
public byte[] FileToBytes(string filePath)
{
FileInfo fi = new FileInfo(filePath);
FileStream fs = fi.OpenRead();
byte[] bytes = new byte[fs.Length];
fs.Read(bytes, 0, Convert.ToInt32(fs.Length));
fs.Close();
return bytes;
}
将文件转换为二进制流/二进制串
最新推荐文章于 2023-09-05 10:26:02 发布