在C#中FileStream.Read循环读取时其参数offest如何设置?

使用FileStream.Read 循环读取一个文件
While(true)
{
byte[] buffer=new byte[1024];
Fs.Read(buffer,0,buffer.length);
........
}
在循环的时候,按照代码所写不应该是每次都从0的位置开始读取吗?但是实际操作中,每次都是从=+buffer.length开始读取。怎么实现的?

参考MSDNFileStream.Read 方法

            // Read the source file into a byte array.
            byte[] bytes = new byte[fsSource.Length];
            int numBytesToRead = (int)fsSource.Length;
            int numBytesRead = 0;
            while (numBytesToRead > 0)
            {
                // Read may return anything from 0 to numBytesToRead.
                int n = fsSource.Read(bytes, numBytesRead, numBytesToRead);

                // Break when the end of the file is reached.
                if (n == 0)
                    break;

                numBytesRead += n;
                numBytesToRead -= n;
            }
             numBytesToRead = bytes.Length;

从流中读取字节块并将该数据写入给定缓冲区中。
C#

public override int Read (byte[] array, int offset, int count);
参数
**array **Byte[]
当此方法返回时,包含指定的字节数组,此数组中 offset 和 (offset + count - 1) 之间的值被从当前源中读取的字节所替换。
**offset **Int32
array 中的字节偏移量,将在此处放置读取的字节。
**count **Int32
最多读取的字节数。

注意这里的offset是第一个参数array中的偏移量,而不是读取的流的偏移量。所以偏移设置为0,指的是将读取到的数据填充到array并从array的偏移位置0开始存放。