天天看点

filestream 用法

using (FileStream fs = new FileStream(@"D:\3\1.xml", FileMode.Open))
           {
               using (FileStream writer = new FileStream(@"D:\3\3.xml", FileMode.Create))
               {
                   byte[] bytes = new byte[1024 * 1024];
                   int count;
                   while ((count = fs.Read(bytes, 0, bytes.Length)) > 0)
                   {
 
                       for (int i = 0; i < bytes.Length; i++)
                       {
 
                           bytes[i] = (byte)(byte.MaxValue - (int)bytes[i]);
 
                       }
 
                       writer.Write(bytes, 0, count);
                   }
 
               }
           }