.NET File.WriteAllLines leaves empty line at the end of file

前端 未结 9 1154
情歌与酒
情歌与酒 2020-12-17 17:58

When I\'m saving content of the String[] array with System.IO.File.WriteAllLines, at the end of a file is always left a blank line. For example:

System.IO.Fi         


        
9条回答
  •  旧时难觅i
    2020-12-17 18:52

    You can also save a file with WriteAllText and join array of lines manually like:

    File.WriteAllText(file, String.Join("\r\n",correctedLines));
    

提交回复
热议问题