dotnet / dotnet/dotnet-api-docs

StreamReader constructor argument bufferSize: wrong explanation in Remarks section

Open
#1,035 1 comment 0 reactions 0 assignees View on GitHub
area-System.IO dotnet-api/prod help wanted Pri2
Dominant language
C#
Stars
949
Forks
1.7k
Avg merge
3d 27m
Merged PRs (30d)
49

Description

It seems that the _Remarks_ section explaining the _bufferSize_ argument used by StreamReader constructors is incorrect:

> The buffer size, in number of 16-bit characters, is set by the bufferSize parameter. If bufferSize is less than the minimum allowable size (128 characters), the minimum allowable size is used.

When looking at the referenc source code (here: https://referencesource.microsoft.com/mscorlib/R/c97df3321103c3ac.html), it looks to me that _bufferSize_ defines the buffer size not in number of 16-bit characters, but rather **in bytes**. In the same manner, the minimum buffer size is not 128 characters, but rather 128 bytes.
(The buffer size in number of 16-bit characters would then be _bufferSize/2_, if i am not mistaken.)

---
#### Document details

⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.*

* ID: 08694de5-3960-b1ad-681c-0b666747f6a7
* Version Independent ID: 2edeccd6-6ad0-e708-3d0e-23901a54028d
* Content: [StreamReader Constructor (System.IO)](https://docs.microsoft.com/en-gb/dotnet/api/system.io.streamreader.-ctor?view=netframework-4.7.2#System_IO_StreamReader__ctor_System_IO_Stream_System_Text_Encoding_System_Boolean_System_Int32_)
* Content Source: [xml/System.IO/StreamReader.xml](https://github.com/dotnet/dotnet-api-docs/blob/master/xml/System.IO/StreamReader.xml)
* Product: **dotnet-api**
* GitHub Login: @dotnet-bot
* Microsoft Alias: **dotnetcontent**

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.