What is the difference between File.ReadAllLines() and File.ReadAllText()?

后端 未结 3 704
谎友^
谎友^ 2020-12-05 06:16

What is the difference between File.ReadAllLines() and File.ReadAllText()?

3条回答
  •  囚心锁ツ
    2020-12-05 06:33

    File.ReadAllText() returns one big string containing all the content of the file while File.ReadAllLines() returns string array of lines in the file.

    Keep in mind that in case of ReadAllText "The resulting string does not contain the terminating carriage return and/or line feed."

    More details are available at remarks section of File.ReadAllText Method and File.ReadAllLines Method.

提交回复
热议问题