MemoryStream读写

            Stream s = new MemoryStream();
StreamWriter w = new StreamWriter(s);
w.WriteLine("!");
w.Flush();
//w.Close();
StreamReader r = new StreamReader(s);
Console.WriteLine(s.Length);
s.Position = 0;
Console.WriteLine(r.ReadToEnd());
posted @ 2012-02-03 10:33  木由水  阅读(313)  评论(0编辑  收藏  举报