FileStream.Seek Method

May 11, 2014

Sets the current position of this stream to the given value.

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

public override long Seek(
	long offset,
	SeekOrigin origin
)

Parameters

offset
Type: System.Int64
The point relative to origin from which to begin seeking.
origin
Type: System.IO.SeekOrigin
Specifies the beginning, the end, or the current position as a reference point for origin, using a value of type SeekOrigin.

Return Value

Type: System.Int64
The new position in the stream.

ExceptionCondition
IOException

An I/O error occurs.

NotSupportedException

The stream does not support seeking, such as if the FileStream is constructed from a pipe or console output.

ArgumentException

Attempted seeking before the beginning of the stream.

ObjectDisposedException

Methods were called after the stream was closed.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

Show:
© 2014 Microsoft