When writing a web application which allows the upload of files, one must be concious of the fact that users of said web application may be on any operating system, including unix-like systems which use <lf> for line ending, mac-like systems which use <cr> for line endings, and windows-like systems which use <cr><lf> for line ending.
Assuming that I want to parse uploaded files (such as csv’s) to access the data within them (for instance so as to import it into my application), is there a standard OS-agnostic method of breaking the file up into its constituent lines for further parsing?
You could use a
StreamReader. The ReadLine method handles the various types of line break: