111,125
社区成员
发帖
与我相关
我的任务
分享
public static string SelectFilePath(string fileter)
{
string filePath = string.Empty;
OpenFileDialog Ofd = new OpenFileDialog();
Ofd.Filter = fileter;
if (Ofd.ShowDialog() == DialogResult.OK)
{
filePath = Ofd.FileName;
}
return filePath;
返回值就是你要的路径

public void Write(string path)
{
FileStream fs = new FileStream(path, FileMode.Create);
StreamWriter sw = new StreamWriter(fs);
//开始写入
sw.Write("Hello World!!!!");
//清空缓冲区
sw.Flush();
//关闭流
sw.Close();
fs.Close();
}