为什么MemoryStream.Read读不出数据

smyzsmez 2005-09-18 02:07:26
byte[] b = new byte[100];
for (byte i = 0; i < b.Length; i++) b[i] = i;
System.IO.MemoryStream ms = new System.IO.MemoryStream();
ms.Write(b, 0, b.Length);
ms.Flush();
byte[] c = new byte[b.Length];
ms.Read(c, 0, c.Length);
按上面这样操作后,c数组的元素值全为零,为什么啊?
...全文
305 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
xxxxxxxxx 2005-09-18
  • 打赏
  • 举报
回复
mark
zhun_yi 2005-09-18
  • 打赏
  • 举报
回复
mark
chenyuming2004 2005-09-18
  • 打赏
  • 举报
回复
byte[] b = new byte[100];
for (byte i = 0; i < b.Length; i++) b[i] = i;
System.IO.MemoryStream ms = new System.IO.MemoryStream();
ms.Write(b, 0, b.Length);
byte[] c = new byte[b.Length];
ms.Position=0;
ms.Read(c, 0, c.Length);

110,534

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧