MemoryStream.Seek Method

May 11, 2014

Sets the position within the current stream to the specified value.

Namespace:  System.IO
Assembly:  mscorlib (in mscorlib.dll)

'Declaration
Public Overrides Function Seek ( _
	offset As Long, _
	loc As SeekOrigin _
) As Long

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.Int64
The new position within the stream, calculated by combining the initial reference point and the offset.

ExceptionCondition
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.

This method overrides Seek.

Seeking to any location beyond the length of the stream is supported.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2014 Microsoft