我的文件导出是不是写的有问题!望高手检查一下哪有问题
如果第二次导出同一文件夹下会在原有的文本下面继续添加,而且选择桌面路劲导出不了 private void button5_Click(object sender, EventArgs e)
{
FolderBrowserDialog dialog = new FolderBrowserDialog();
dialog.Description = "请选择文件路径";
if (dialog.ShowDialog() == DialogResult.OK)
{
string foldPath = dialog.SelectedPath;
string path = @foldPath + "PosDesBack.CSV";
StreamWriter sw = new StreamWriter(path, true, Encoding.Default);
foreach (PosDes pd in _posdesList)
{
sw.WriteLine(string.Format("{0},{1},{2},{3}", pd.PosID, pd.Longitude, pd.Latitude, pd.PosDes));
}
sw.Close();
MessageBox.Show("导出完成");
}
}