我正在使用此代码将connectstream写入memorystream:
buffer = new byte[8 * 1024];
while ((len = stream.Read(buffer, 0, buffer.Length)) > 0)
{
mStream.Write(buffer, 0, len);
}
但我总是收到错误:
there was a problem reading this document (109)
答案 0 :(得分:1)
循环完成后,MemoryStream将保持定位到流的末尾。从中读取不会产生任何结果。添加:
mStream.Position = 0;