不用
using System.IO;
try
{
FileStream stream = new FileStream("test.txt", FileMode.Create, FileAccess.Write);
StreamWriter sw = new StreamWriter(stream);
string text="hello world";
sw.WriteLine(text);
sw.Close();
stream.Close();
}
catch (IOException e)
{
MessageBox.Show(e.Message);
}
直接写进txt文件就可以了