dotnet / dotnet/dotnet-api-docs

incorrect Remarks for TextReader.Read

Open
#2,040 5 comments 0 reactions 0 assignees View on GitHub
area-System.IO Pri3 waiting-on-feedback
Dominant language
C#
Stars
949
Forks
1.7k
Avg merge
3d 27m
Merged PRs (30d)
49

Description

https://docs.microsoft.com/en-us/dotnet/api/system.io.streamreader.read?view=netframework-4.7.2#System_IO_StreamReader_Read_System_Char___System_Int32_System_Int32_

In `Returns` of `Read(Char[], Int32, Int32)`,

> The number of characters that have been read, or 0 if at the end of the stream and no data was read. The number will be less than or equal to the count parameter, depending on whether the data is available within the stream.

In `Remarks`,

> This method returns after either the number of characters specified by the count parameter are read, or the end of the file is reached. ReadBlock is a blocking version of Read.

The remarks seems incorrect to me: the API could return with a number that have been read and be less than the input count parameter.

edit by @mairaw: updated URL to go to the specific overload

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.