- offset
- The new position within the stream. This is relative to the loc parameter, and can be positive or negative.
- loc
- A value of type System.IO.SeekOrigin, which acts as the seek reference point.
The new position within the stream, calculated by combining the initial reference point and the offset.
Type Reason System.IO.IOException Seeking is attempted before the beginning of the stream. ArgumentOutOfRangeException offset is greater than the maximum length of System.IO.MemoryStream. ArgumentException loc is not a valid System.IO.SeekOrigin value. ObjectDisposedException The current stream is closed.
This method overrides Stream.Seek(long, SeekOrigin).
Seeking to any location beyond the length of the stream is supported.
Do not use the MemoryStream.Seek(long, SeekOrigin) method to determine the new position in the stream if the System.IO.MemoryStream was initialized with a non-zero offset. If you do, MemoryStream.Seek(long, SeekOrigin) will return an inaccurate value. Instead, use the MemoryStream.Position property to get the new position of the stream.