MemoryStream.Seek Method
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Sets the position within the current stream to the specified value.
Assembly: mscorlib (in mscorlib.dll)
Parameters
- offset
- Type: System.Int64
The new position within the stream. This is relative to the loc parameter, and can be positive or negative.
- loc
- Type: System.IO.SeekOrigin
A value of type SeekOrigin, which acts as the seek reference point.
Return Value
Type: System.Int64The new position within the stream, calculated by combining the initial reference point and the offset.
| Exception | Condition |
|---|---|
| IOException | Seeking is attempted before the beginning of the stream. |
| ArgumentOutOfRangeException | offset is greater than MaxValue. |
| ArgumentException | There is an invalid SeekOrigin. |
| ObjectDisposedException | The current stream instance is closed. |
Show: