C# 中如何将byte[] 保存到 文件中?

解决方案 »

  1.   

    System.IO.FileStream fs = new System.IO.FileStream("filepath", System.IO.FileMode.OpenOrCreate);
    fs.WriteByte(bytes);
    fs.Close();
      

  2.   

    如何:对新建的数据文件进行读取和写入 
    http://msdn.microsoft.com/zh-cn/vbasic/36b93480.aspx
      
    *****************************************************************************
    欢迎使用CSDN论坛专用阅读器 : CSDN Reader(附全部源代码) http://feiyun0112.cnblogs.com/
      

  3.   

    byte[] bytes = (byte[])dr["img"]; //bytes是你的字节数组
    FileStream fs = new FileStream(Server.MapPath("//img//1.gif"), FileMode.Create, FileAccess.Write);
    fs.Write(bytes, 0, bytes.Length);
    fs.Flush();
    fs.Close();