C# 为什么我的hello world和streams没有显示任何内容?
设置C# 为什么我的hello world和streams没有显示任何内容?,c#,.net,stream,C#,.net,Stream,设置 ff.Position=0 在阅读之前,否则您将在流的末尾开始阅读 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.IO; namespace CSQuick { class Program { static void Main(string[] args) { usi
ff.Position=0代码>
在阅读之前,否则您将在流的末尾开始阅读
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());
}
}
}
}
}