Export (0) Print
Expand All

MemoryStream.Seek Method

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

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

public override long Seek(
	long offset,
	SeekOrigin loc
)

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.

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

ADD
Show:
© 2015 Microsoft