Skip to content

StreamReader.ReadLine should document how newline at the end of the file is treated #12491

@svick

Description

@svick

Describe the issue or suggestion

When StreamReader.ReadLine (and similar APIs, like File.ReadAllLines) reads a stream that ends in a newline, it doesn't produce a final empty line.

For example, a file containing the string "foo\nbar\n" is interpreted as having two lines, "foo" and "bar" (a file containing just "foo\nbar" is interpreted the exact same way).

This is common behavior (especially on Unix), but not universal, and it can be confusing, so I think it makes sense to briefly mention this in all affected APIs.

Metadata

Metadata

Labels

area-System.IOuntriagedNew issue has not been triaged by the area owner

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions