3
我正在使用System.IO.Stream.Read(byte[] buffer, int offset, int count)
。是否有替代方法(或设置属性),以便该方法不会返回,直到读取所有计数(或达到流结束)?或者我应该这样做:阻止版本的System.IO.Stream.Read(byte [],int,int)
int n = 0, readCount = 0;
while ((n = myStream.Read(buffer, readCount, countToRead - readCount)) > 0)
readCount += n;