/// 读 public void inint() { FileStream fs = new FileStream("D:/123.txt",FileMode.Open,FileAccess.Read ); StreamReader sr = new StreamReader(fs); sr.BaseStream.Seek(0, SeekOrigin.Begin); string str = sr.ReadToEnd(); if (str!="") { Console.WriteLine("{0}", str); str = sr.ReadLine(); } sr.Close(); fs.Close(); }///写入 using (StreamWriter sw=File.AppendText("D:/123.txt")) { sw.Write("我爱你中国"); sw.Dispose(); }