为什么我的hello世界没有显示任何内容
本文关键字:显示 任何内 我的 hello 世界 为什么 | 更新日期: 2023-09-27 17:59:29
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace CSQuick
{
class Program
{
static void Main(string[] args)
{
using (var ff = new MemoryStream())
using (var f = new StreamWriter(ff))
{
f.WriteLine("Stream hello world fail");
f.Flush();
using (TextReader ts = new StreamReader(ff))
{
Console.WriteLine(ts.ReadToEnd());
}
}
}
}
}
设置ff.Position = 0;
在阅读之前,否则您将从流的末尾开始阅读。