/// <summary>
/// 获取文件字节数组byte[]
/// </summary>
/// <param name="path"></param>
/// <returns></returns>
public byte[] GetFileByte(string path)
{
Stream s = File.Open(path, FileMode.Open);
int leng = 0;
if (s.Length < Int32.MaxValue)
leng = (int)s.Length;
byte[] by = new byte[leng];
s.Read(by, 0, leng);//把文件读到字节数组中
s.Close();
return by;
}
获取文件字节数组byte[]
最新推荐文章于 2024-06-04 15:10:08 发布