Mono Class Library: System.IO.MemoryStream Overview | Members

System.IO.MemoryStream.Seek Method

Changes the position within the current stream by the given offset, which is relative to the stated origin.

public override long Seek (long offset, SeekOrigin loc)

Parameters

offset
A long that specifies the new position within the stream. This is relative to the loc parameter, and can be positive or negative.
loc
A System.IO.SeekOrigin value that specifies the seek reference point.

Returns

A long containing the new position within the stream, calculated by combining the seek reference point and the offset.

Exceptions

TypeReason
System.IO.IOExceptionSeeking is attempted before the beginning of the stream.
ArgumentOutOfRangeExceptionoffset is greater than the maximum length of System.IO.MemoryStream.
ArgumentExceptionloc is not a valid System.IO.SeekOrigin value.
ObjectDisposedException The current stream is closed.

Remarks

Note: This method overrides Stream.Seek(long, SeekOrigin).

Requirements

Namespace: System.IO
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0