- offset
- The point relative to origin from which to begin seeking.
- origin
- Specifies the beginning, the end, or the current position as a reference point for offset, using a value of type System.IO.SeekOrigin.
The new position in the stream.
Type Reason System.IO.IOException An I/O error occurred. NotSupportedException The stream does not support seeking. ArgumentException Attempted seeking before the beginning of the stream or to more than one byte past the end of the stream. ObjectDisposedException The current stream is closed.
This method overrides Stream.Seek(long, SeekOrigin).
Use the FileStream.CanSeek property to determine whether the current instance supports seeking. For additional information, see Stream.CanSeek.
You can seek to any location beyond the length of the stream. When you seek beyond the length of the file, the file size grows. In Windows NT and later versions, data added to the end of the file is set to zero. In Windows 98 or earlier versions, data added to the end of the file is not set to zero, which means that previously deleted data is visible to the stream.
For a list of common file and directory operations, see Common I/O Tasks.