C# 将文件加载到内存

         FileStream fs = new FileStream(strFile, FileMode.Open);
         byte[] aa = new byte[fs.Length - 1];
         fs.Read(aa,0,((int)fs.Length - 1));
         fs.Close();
         fs.Dispose();
         File.Delete(strFile);
         writeMem();
         FileStream fw = new FileStream(strFile, FileMode.Create);
         fw.Write(aa, 0, ((int)aa.Length - 1));
         fw.Close();
         fw.Dispose();

你可能感兴趣的:(c#相关)