Determines the position within the current stream.
[Visual Basic] MustOverride Public Property Position As Long [C#] public long Position {abstract get; abstract set;} [C++] public: __property virtual __int64 get_Position() = 0;public: __property virtual void set_Position(__int64) = 0; [JScript] public abstract function get Position() : long; public abstract function set Position(long);
The current position within the stream.
Exception Type | Condition |
---|---|
IOException | An I/O error occurs. |
NotSupportedException | The stream does not support seeking. |
This stream must support seeking to get or set the position. Use the CanSeek property to determine whether the stream supports seeking.
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.
The default get accessor invokes the Seek method. The default set accessor calls Seek and returns the result. Therefore, it is possible to override Seek so that the Position property provides the functionality described above.