How to write a text file in C#

前端 未结 4 628
抹茶落季
抹茶落季 2020-12-07 02:48

I need to write a strings into a text file from C#, each string on a new line...How can I do this?

4条回答
  •  北海茫月
    2020-12-07 03:27

    If you wish to append the text lines to the file, use AppendAllText:

    string appendText = "This is extra text" + Environment.NewLine;
    File.AppendAllText(path, appendText);
    

提交回复
热议问题