日期:2014-05-20  浏览次数:21185 次

正由另一进程使用,因此该进程无法访问该文件
FileStream fs = new FileStream(indicator.GetFullFileName(this._DbFolder), FileMode.Open, FileAccess.Read,FileShare.Read);
  BinaryReader b= new BinaryReader(fs);

  int byteCount = prev.ByteCount;
  int startPosition = byteCount * startIndex;

  b.BaseStream.Seek(startPosition, SeekOrigin.Begin);
  byte[] bs = b.ReadBytes(byteCount);

  breader.Close();
  fs.Close();


文件流也关闭了啊,而且fileShare也设了Read,问什么还提示这个错误呢

------解决方案--------------------
那个文件是不是有程序正在访问,你没关啊

------解决方案--------------------
fs.Dispose();
------解决方案--------------------

报这个错不一定是这里代码有问题

看看前面代码。。是不是哪里没有关。。。