Skip to content

Commit ec4f8f8

Browse files
authored
Align MemoryStream Position and Seek docs with SetLength
Updated ArgumentOutOfRangeException documentation for Position property and Seek method to include the more precise explanation about the maximum length calculation that accounts for the origin parameter. Both now match the detailed description in SetLength, specifying that the maximum length is (Int32.MaxValue - origin), where origin is the index into the underlying buffer at which the stream starts. Fixes #9201
1 parent c9db664 commit ec4f8f8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

xml/System.IO/MemoryStream.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1800,7 +1800,7 @@ The pending operation does not support writing.</exception>
18001800
18011801
]]></format>
18021802
</remarks>
1803-
<exception cref="T:System.ArgumentOutOfRangeException">The position is set to a negative value or a value greater than <see cref="F:System.Int32.MaxValue">Int32.MaxValue</see>.</exception>
1803+
<exception cref="T:System.ArgumentOutOfRangeException">The position is set to a negative value or a value greater than the maximum length of the <see cref="T:System.IO.MemoryStream" />, where the maximum length is (<see cref="F:System.Int32.MaxValue">Int32.MaxValue</see> - <code>origin</code>), and <code>origin</code> is the index into the underlying buffer at which the stream starts.</exception>
18041804
<exception cref="T:System.ObjectDisposedException">The stream is closed.</exception>
18051805
<related type="Article" href="/dotnet/standard/io/">File and Stream I/O</related>
18061806
<related type="Article" href="/dotnet/standard/io/how-to-read-text-from-a-file">How to: Read Text from a File</related>
@@ -2244,7 +2244,7 @@ The pending operation does not support writing.</exception>
22442244
</remarks>
22452245
<exception cref="T:System.IO.IOException">Seeking is attempted before the beginning of the stream.</exception>
22462246
<exception cref="T:System.ArgumentOutOfRangeException">
2247-
<paramref name="offset" /> is greater than <see cref="F:System.Int32.MaxValue">Int32.MaxValue</see>.</exception>
2247+
<paramref name="offset" /> is greater than the maximum length of the <see cref="T:System.IO.MemoryStream" />, where the maximum length is (<see cref="F:System.Int32.MaxValue">Int32.MaxValue</see> - <code>origin</code>), and <code>origin</code> is the index into the underlying buffer at which the stream starts.</exception>
22482248
<exception cref="T:System.ArgumentException">There is an invalid <see cref="T:System.IO.SeekOrigin" />.
22492249

22502250
-or-

0 commit comments

Comments
 (0)