Error scenarios:
Open a file using the filestream object and want to read it in the cache. Because the cache size is 1 kb, you need to read it in multiple times. However, when using the filestream. Read () method,
Error code:
Byte [] sendbuf = new byte [m_nblocksize];
Int nread = readfile. Read (sendbuf, noffset, m_nblocksize );
When noffset = 1, an error is always thrown: the offset and length exceed the limit of the array, or the count is greater than the ending point from the index to the source set.
Error cause:
The meaning of each parameter is not clear.
Filestream
Public override int read (byte [] array, int offset, int count)
Where:
Array
Type: array <system...:. byte> [] () []
This method contains the specified byte array, and the offset and (Offset + count-
1) The value is replaced by the byte read from the current source.
Offset
Type: system...:. int32
The Byte offset in array, where the byte is read.
Count
Type: system...:. int32
The maximum number of bytes read.
At the beginning, the error indicates that offset is a cheap file stream, which leads to this error.