C# 输入日志文件方法





### C# 输入日志文件方法

```c#
  public static void AddLgoToTXT(string logstring)
  {
      string path = AppDomain.CurrentDomain.BaseDirectory + "log_opera.txt";
      if (!System.IO.File.Exists(path))
      {
      FileStream stream = System.IO.File.Create(path);
      stream.Close();
      stream.Dispose();
      }
      using (StreamWriter writer = new StreamWriter(path, true))
      {
      writer.WriteLine(logstring);
      }
  }

//网络素材仅限收藏 方便学习

posted @ 2021-06-07 09:30  New_HackerHK  阅读(69)  评论(0编辑  收藏  举报