using System; using System.Collections.Generic; using System.Text; using System.IO;namespace ConsoleApplication14 { class Program { static void Main(string[] args) { StreamReader reader = new StreamReader(@"c:\a.txt"); string content = reader.ReadToEnd();//这句是关键,从流的开始读到流的结束 Console.WriteLine(content); Console.ReadLine(); } } }
using (StreamReader sr = new StreamReader("my.txt")) { string content = sr.ReadToEnd(); }
StreamReader hc = new StreamReader(@"C:\database.txt"); string ss = hc.ReadToEnd(); this.richTextBox1.Text = ss.ToString();
StreamReader reader = new StreamReader("路径"); string content = reader.ReadToEnd();
using System.Collections.Generic;
using System.Text;
using System.IO;namespace ConsoleApplication14
{
class Program
{
static void Main(string[] args)
{
StreamReader reader = new StreamReader(@"c:\a.txt");
string content = reader.ReadToEnd();//这句是关键,从流的开始读到流的结束
Console.WriteLine(content);
Console.ReadLine();
}
}
}
using (StreamReader sr = new StreamReader("my.txt"))
{
string content = sr.ReadToEnd();
}
string ss = hc.ReadToEnd();
this.richTextBox1.Text = ss.ToString();
string content = reader.ReadToEnd();