NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

FileStream.Seek

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

[Visual Basic]
Overrides Public Function Seek( _
   ByVal offset As Long, _
   ByVal origin As SeekOrigin _
) As Long
[C#]
public override long Seek(
   long offset,
   SeekOrigin origin
);
[C++]
public: override __int64 Seek(
   __int64 offset,
   SeekOrigin origin
);
[JScript]
public override function Seek(
   offset : long,
   origin : SeekOrigin
) : long;

Parameters

offset
The new position of the stream.
origin
The point to seek relative to. Uses a field from SeekOrigin.

Return Value

The new position in the stream.

Exceptions

Exception Type Condition
IOException An I/O error occurs.
NotSupportedException The stream does not support seeking.
EndOfStreamException Seeking was attempted past the end of a stream that does not support this.

Remarks

The position cannot be set more than one byte beyond the end of the stream. You can set the position to just beyond the last byte so you can append to the file. Opening a new file and then writing to it requires this.

See Also

FileStream Class | FileStream Members | System.IO Namespace