This documentation is archived and is not being maintained.

BufferedStream.Position Property

Gets the position within the current stream.

[Visual Basic]
Overrides Public Property Position As Long
public override long Position {get; set;}
public: __property __int64 get_Position();
public: __property void set_Position(__int64);
public override function get Position() : long;
public override function set Position(long);

Property Value

The position within the current stream.


Exception Type Condition
ArgumentOutOfRangeException The value passed to Seek is negative.
IOException An I/O error occurs, such as the stream being closed.
NotSupportedException The stream does not support seeking.
ObjectDisposedException Methods were called after the stream was closed.


For an example of creating a file and writing text to a file, see Writing Text to a File. For an example of reading text from a file, see Reading Text from a File. For an example of reading from and writing to a binary file, see Reading and Writing to a Newly Created Data File.

The get accessor invokes Seek to obtain the current position within the underlying stream and then adjusts this value according to the current position within the buffer.

The set accessor copies any data previously written to the buffer to the underlying stream, and then invokes Seek.

Seeking to any location beyond the length of the stream is supported.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

BufferedStream Class | BufferedStream Members | System.IO Namespace | CanSeek | Seek | Working with I/O | Reading Text from a File | Writing Text to a File