示例
代码
string allInfo = "123";
SaveFileDialog saveFileDialog = new SaveFileDialog();
saveFileDialog.Filter = "*.txt|*.txt|所有文件(*.*)|*.*";
if (!(bool)saveFileDialog.ShowDialog())
{
return;
}
string fileName = saveFileDialog.FileName;
FileStream fileStream = new FileStream(fileName, FileMode.Append);
StreamWriter streamWriter = new StreamWriter(fileStream, Encoding.Default);
streamWriter.Write(allInfo + "\r\n");
streamWriter.Flush();
streamWriter.Close();
fileStream.Close();
MessageBox.Show("保存成功!");