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. [Edit]

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. [Edit]
loc
A System.IO.SeekOrigin value that specifies the seek reference point. [Edit]

Returns

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

Exceptions

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

Remarks

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

Requirements

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