我有一个由内存流支持的二进制写入器:
BinaryWriter m_binaryWriter = new BinaryWriter(new MemoryStream(BUFFER_SIZE));
我想获取基本阅读器并将其读入字节数组:
long DataLength = m_binaryWriter.BaseStream.Length;
byte[] MemoryStrData = new byte[DataLength];
int BytesRead = m_binaryWriter.BaseStream.Read(MemoryStrData, 0, (int)DataLength);
但是,BytesRead 始终为 0(显然 MemoryStrData 包含所有 0)。我尝试使用 BinaryReader 从基本流中读取流,但这导致了同样的事情。我在这里错过了什么吗?