创建一个文本文件,文本写至这个文件里。

存储文本到一个文件里

 

 class Bu
    {
        public string fileName { get; set; } = "hello.txt";
        public string  filecontent { get; set; }
        public void WriteText2File()
        {            
            using (StreamWriter writer = File.CreateText(System.IO.Path.GetTempPath() + fileName))
            {
                writer.WriteLine(filecontent);
            }
            Console.ReadLine();
        }
    }
Source Code

相关文章:

  • 2022-12-23
  • 2021-11-20
  • 2022-12-23
  • 2022-12-23
  • 2021-06-15
  • 2022-12-23
  • 2021-12-04
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-08-01
  • 2021-06-08
  • 2021-11-06
  • 2021-10-27
  • 2022-12-23
相关资源
相似解决方案