返回首页


string path = "C:\\mytest.txt";

 

if (File.Exists(path))

{

  File.Delete(path);

}

using (FileStream fs = File.Create(path))

{

  //fs.Close();

  // fs.CanWrite = true;

  TextWriter sw = new StreamWriter("C:\\mytest.txt");//error is coming here

  sw.WriteLine("ddd", "dddd", "dsdsd");

  --------------

  -------------

  --------

} 


我想创建并写入文本文件,但给错误文件正在被另一个人使用

回答

评论会员: 时间:2