Skip to content

Commit 004cb37

Browse files
authored
Correct bufferSize parameter descriptions in StreamReader and StreamWriter XML docs
1 parent 3d79db6 commit 004cb37

File tree

3 files changed

+19
-14
lines changed

3 files changed

+19
-14
lines changed

.vscode/settings.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"githubPullRequests.ignoredPullRequestBranches": [
3+
"main"
4+
]
5+
}

xml/System.IO/StreamReader.xml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -974,13 +974,13 @@
974974
<param name="stream">The stream to be read.</param>
975975
<param name="encoding">The character encoding to use.</param>
976976
<param name="detectEncodingFromByteOrderMarks">Indicates whether to look for byte order marks at the beginning of the file.</param>
977-
<param name="bufferSize">The minimum buffer size.</param>
977+
<param name="bufferSize">The minimum buffer size, in bytes.</param>
978978
<summary>Initializes a new instance of the <see cref="T:System.IO.StreamReader" /> class for the specified stream, with the specified character encoding, byte order mark detection option, and buffer size.</summary>
979979
<remarks>
980980
<format type="text/markdown"><![CDATA[
981981
982982
## Remarks
983-
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.
983+
The buffer size, in bytes, is set by the `bufferSize` parameter. If `bufferSize` is less than the minimum allowable size (128 bytes), the minimum allowable size is used.
984984
985985
This constructor allows you to change the encoding the first time you read from the <xref:System.IO.StreamReader> object. The `detectEncodingFromByteOrderMarks` parameter detects the encoding by looking at the first four bytes of the stream. It automatically recognizes UTF-8, little-endian UTF-16, big-endian UTF-16, little-endian UTF-32, and big-endian UTF-32 text if the file starts with the appropriate byte order marks. Otherwise, the user-provided encoding is used. See the <xref:System.Text.Encoding.GetPreamble%2A?displayProperty=nameWithType> method for more information.
986986
@@ -1008,7 +1008,7 @@
10081008
<exception cref="T:System.ArgumentNullException">
10091009
<paramref name="stream" /> or <paramref name="encoding" /> is <see langword="null" />.</exception>
10101010
<exception cref="T:System.ArgumentOutOfRangeException">
1011-
<paramref name="bufferSize" /> is less than or equal to zero.</exception>
1011+
<paramref name="bufferSize" /> is less than or equal to zero, except for -1, which is allowed to indicate the default buffer size.</exception>
10121012
<altmember cref="T:System.Text.Encoding" />
10131013
<related type="Article" href="/dotnet/standard/io/">File and Stream I/O</related>
10141014
<related type="Article" href="/dotnet/standard/io/how-to-read-text-from-a-file">How to: Read Text from a File</related>
@@ -1077,7 +1077,7 @@
10771077
<param name="path">The complete file path to be read.</param>
10781078
<param name="encoding">The character encoding to use.</param>
10791079
<param name="detectEncodingFromByteOrderMarks">Indicates whether to look for byte order marks at the beginning of the file.</param>
1080-
<param name="bufferSize">The minimum buffer size, in number of 16-bit characters.</param>
1080+
<param name="bufferSize">The minimum buffer size, in bytes.</param>
10811081
<summary>Initializes a new instance of the <see cref="T:System.IO.StreamReader" /> class for the specified file name, with the specified character encoding, byte order mark detection option, and buffer size.</summary>
10821082
<remarks>
10831083
<format type="text/markdown"><![CDATA[
@@ -1087,7 +1087,7 @@
10871087
10881088
This constructor allows you to change the encoding the first time you read from the <xref:System.IO.StreamReader> object. The `detectEncodingFromByteOrderMarks` parameter detects the encoding by looking at the first four bytes of the stream. It automatically recognizes UTF-8, little-endian UTF-16, big-endian UTF-16, little-endian UTF-32, and big-endian UTF-32 text if the file starts with the appropriate byte order marks. Otherwise, the user-provided encoding is used. See the <xref:System.Text.Encoding.GetPreamble%2A?displayProperty=nameWithType> method for more information.
10891089
1090-
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.
1090+
The buffer size, in bytes, is set by the `bufferSize` parameter. If `bufferSize` is less than the minimum allowable size (128 bytes), the minimum allowable size is used.
10911091
10921092
The `path` parameter can be a file name, including a file on a Universal Naming Convention (UNC) share.
10931093
@@ -1115,7 +1115,7 @@
11151115
<exception cref="T:System.NotSupportedException">
11161116
<paramref name="path" /> includes an incorrect or invalid syntax for file name, directory name, or volume label.</exception>
11171117
<exception cref="T:System.ArgumentOutOfRangeException">
1118-
<paramref name="bufferSize" /> is less than or equal to zero.</exception>
1118+
<paramref name="bufferSize" /> is less than or equal to zero, except for -1, which is allowed to indicate the default buffer size.</exception>
11191119
<altmember cref="T:System.Text.Encoding" />
11201120
<related type="Article" href="/dotnet/standard/io/">File and Stream I/O</related>
11211121
<related type="Article" href="/dotnet/standard/io/how-to-read-text-from-a-file">How to: Read Text from a File</related>
@@ -1249,7 +1249,7 @@
12491249
<param name="encoding">The character encoding to use.</param>
12501250
<param name="detectEncodingFromByteOrderMarks">
12511251
<see langword="true" /> to look for byte order marks at the beginning of the file; otherwise, <see langword="false" />.</param>
1252-
<param name="bufferSize">The minimum buffer size.</param>
1252+
<param name="bufferSize">The minimum buffer size, in bytes.</param>
12531253
<param name="leaveOpen">
12541254
<see langword="true" /> to leave the stream open after the <see cref="T:System.IO.StreamReader" /> object is disposed; otherwise, <see langword="false" />.</param>
12551255
<summary>Initializes a new instance of the <see cref="T:System.IO.StreamReader" /> class for the specified stream based on the specified character encoding, byte order mark detection option, and buffer size, and optionally leaves the stream open.</summary>
@@ -1259,7 +1259,7 @@
12591259
## Remarks
12601260
Unless you set the `leaveOpen` parameter to `true`, the <xref:System.IO.StreamReader> object calls <xref:System.IO.Stream.Dispose> on the provided <xref:System.IO.Stream> object when <xref:System.IO.StreamReader.Dispose%2A?displayProperty=nameWithType> is called.
12611261
1262-
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.
1262+
The buffer size, in bytes, is set by the `bufferSize` parameter. If `bufferSize` is less than the minimum allowable size (128 bytes), the minimum allowable size is used.
12631263
12641264
This constructor enables you to change the encoding the first time you read from the <xref:System.IO.StreamReader> object. If the `detectEncodingFromByteOrderMarks` parameter is `true`, the constructor detects the encoding by looking at the first four bytes of the stream. It automatically recognizes UTF-8, little-endian UTF-16, big-endian UTF-16, little-endian UTF-32, and big-endian UTF-32 text if the file starts with the appropriate byte order marks. Otherwise, the user-provided encoding is used. See the <xref:System.Text.Encoding.GetPreamble%2A?displayProperty=nameWithType> method for more information.
12651265

xml/System.IO/StreamWriter.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@
612612
<Docs>
613613
<param name="stream">The stream to write to.</param>
614614
<param name="encoding">The character encoding to use.</param>
615-
<param name="bufferSize">The buffer size, in bytes.</param>
615+
<param name="bufferSize">The buffer size, in characters.</param>
616616
<summary>Initializes a new instance of the <see cref="T:System.IO.StreamWriter" /> class for the specified stream by using the specified encoding and buffer size.</summary>
617617
<remarks>
618618
<format type="text/markdown"><![CDATA[
@@ -640,7 +640,7 @@
640640
<exception cref="T:System.ArgumentNullException">
641641
<paramref name="stream" /> or <paramref name="encoding" /> is <see langword="null" />.</exception>
642642
<exception cref="T:System.ArgumentOutOfRangeException">
643-
<paramref name="bufferSize" /> is negative.</exception>
643+
<paramref name="bufferSize" /> is less than or equal to zero, except for -1, which is allowed to indicate the default buffer size.</exception>
644644
<exception cref="T:System.ArgumentException">
645645
<paramref name="stream" /> is not writable.</exception>
646646
<altmember cref="T:System.Text.Encoding" />
@@ -871,7 +871,7 @@
871871
<Docs>
872872
<param name="stream">The stream to write to.</param>
873873
<param name="encoding">The character encoding to use.</param>
874-
<param name="bufferSize">The buffer size, in bytes.</param>
874+
<param name="bufferSize">The buffer size, in characters.</param>
875875
<param name="leaveOpen">
876876
<see langword="true" /> to leave the stream open after the <see cref="T:System.IO.StreamWriter" /> object is disposed; otherwise, <see langword="false" />.</param>
877877
<summary>Initializes a new instance of the <see cref="T:System.IO.StreamWriter" /> class for the specified stream by using the specified encoding and buffer size, and optionally leaves the stream open.</summary>
@@ -899,7 +899,7 @@
899899
<exception cref="T:System.ArgumentNullException">
900900
<paramref name="stream" /> or <paramref name="encoding" /> is <see langword="null" />.</exception>
901901
<exception cref="T:System.ArgumentOutOfRangeException">
902-
<paramref name="bufferSize" /> is negative.</exception>
902+
<paramref name="bufferSize" /> is less than or equal to zero, except for -1, which is allowed to indicate the default buffer size.</exception>
903903
<exception cref="T:System.ArgumentException">
904904
<paramref name="stream" /> is not writable.</exception>
905905
</Docs>
@@ -967,7 +967,7 @@
967967
<param name="append">
968968
<see langword="true" /> to append data to the file; <see langword="false" /> to overwrite the file. If the specified file does not exist, this parameter has no effect, and the constructor creates a new file.</param>
969969
<param name="encoding">The character encoding to use.</param>
970-
<param name="bufferSize">The buffer size, in bytes.</param>
970+
<param name="bufferSize">The buffer size, in characters.</param>
971971
<summary>Initializes a new instance of the <see cref="T:System.IO.StreamWriter" /> class for the specified file on the specified path, using the specified encoding and buffer size. If the file exists, it can be either overwritten or appended to. If the file does not exist, this constructor creates a new file.</summary>
972972
<remarks>
973973
<format type="text/markdown"><![CDATA[
@@ -1003,7 +1003,7 @@
10031003
<exception cref="T:System.ArgumentNullException">
10041004
<paramref name="path" /> or <paramref name="encoding" /> is <see langword="null" />.</exception>
10051005
<exception cref="T:System.ArgumentOutOfRangeException">
1006-
<paramref name="bufferSize" /> is negative.</exception>
1006+
<paramref name="bufferSize" /> is less than or equal to zero, except for -1, which is allowed to indicate the default buffer size.</exception>
10071007
<exception cref="T:System.IO.IOException">
10081008
<paramref name="path" /> includes an incorrect or invalid syntax for file name, directory name, or volume label syntax.</exception>
10091009
<exception cref="T:System.Security.SecurityException">The caller does not have the required permission.</exception>

0 commit comments

Comments
 (0)