C#对文本进行简单的写入

来源:互联网 发布:淘宝网开店费用高吗 编辑:程序博客网 时间:2024/06/05 04:32
 

 string path = System.IO.Directory.GetCurrentDirectory();//相对路径 FileInfo fi = new FileInfo(path + @"\Data\unity.txt");  ////如果该文件存在需要删除重新写入  if (fi.Exists) {   fi.Delete();   }
  StreamWriter sw = new StreamWriter(path + @"\Data\StreamingAssets\unity.txt");   sw.WriteLine(需要写入的内容方法);   sw.Close();   MessageBox.Show("写入成功! ^-^ ", "TaoHu", MessageBoxButtons.OK, MessageBoxIcon.None);
 

 

原创粉丝点击