Align MemoryStream Position and Seek docs with SetLength
Summary
- Updated
ArgumentOutOfRangeExceptiondocumentation forMemoryStream.Positionproperty andMemoryStream.Seekmethod - Aligned exception descriptions with the more detailed explanation used in
SetLengthmethod - Added clarification about how the
originparameter affects the maximum valid position/offset
Details
The SetLength method already included a precise explanation of the ArgumentOutOfRangeException that mentions
the origin parameter:
where the maximum length is (Int32.MaxValue - origin), and origin is the index into the underlying buffer at which the stream starts.
However, the Position property and Seek method only mentioned Int32.MaxValue without explaining how the
origin affects the valid range.
Changes Made
Position property - Updated from:
The position is set to a negative value or a value greater than Int32.MaxValue.
To:
The position is set to a negative value or a value greater than the maximum length of the MemoryStream, where the maximum length is (Int32.MaxValue - origin), and origin is the index into the underlying buffer at which the stream starts.
Seek method - Updated from:
offset is greater than Int32.MaxValue.
To:
offset is greater than the maximum length of the MemoryStream, where the maximum length is (Int32.MaxValue - origin), and origin is the index into the underlying buffer at which the stream starts.
This provides developers with consistent and more accurate information about the actual constraints when working with MemoryStream instances that may have been initialized with a non-zero origin offset.
Fixes #9201