当你的内存不够用的时候你应该这样写入文件

 MemoryStream stream          
BinaryWriter bw = new BinaryWriter(stream); for (Int32 i = 0; i < 100; i++) { bw.Write(100); } FileStream dumpFile = new FileStream(System.Web.HttpContext.Current.Request.MapPath("~/a.txt"), FileMode.Create, FileAccess.ReadWrite); stream.WriteTo(dumpFile); dumpFile.Flush(); dumpFile.Close();

 

posted @ 2018-07-28 13:48  伤心木乃伊  阅读(193)  评论(0编辑  收藏  举报