StreamReader sr = new StreamReader(要写入的文件名, Encoding.Default);
StreamWriter sw = new StreamWriter (临时文件,Encoding.Default);
string[]a={aaa,bbb,ccc};
string temp = String.Join( , a); // 用空隔连接aaa bbb ccc三个字符串int i=0;while(!sr.EndOfStream){if(i++<3)
sw.WriteLine( sr.ReadLine() + temp ); //头三行加上aaa bbb cccelsesw.WriteLine( sr.ReadLine() );}sr.Dispose();
File.Move( 临时文件, 要写入的文件名 );