0

StreamReader Clarification

In a file, set up as 123,456 789,1011,1213 does the StreamReader read it as 123,456,789 etc or as before. i.e does it remove the newline and act as if a file is all on one line

10th Dec 2017, 10:55 AM
Roguesquid
Roguesquid - avatar
1 ответ
+ 1
There are two primary methods on stream reader. Read and ReadToEnd. ReadToEnd will read the entire file including the return feed and newline. So in short, it will read it as it is in the document unless you escape the return feed and the newline characters. var split = content.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries); Where content is the string returned from the StreamReader ReadToEnd method. (there are numerous other methods that read byte by byte or by line or per block of data specified by byte length)
12th Dec 2017, 8:15 PM
John
John - avatar