UnmanagedMemoryStream.Position UnmanagedMemoryStream.Position UnmanagedMemoryStream.Position UnmanagedMemoryStream.Position Property

定義

取得或設定資料流中目前的位置。Gets or sets the current position in a stream.

public:
 virtual property long Position { long get(); void set(long value); };
public override long Position { get; set; }
member this.Position : int64 with get, set
Public Overrides Property Position As Long

屬性值

在資料流中的目前位置。The current position in the stream.

例外狀況

位置設為小於零的值,或位置大於 MaxValue,或加入目前的指標時導致溢位。The position is set to a value that is less than zero, or the position is larger than MaxValue or results in overflow when added to the current pointer.

備註

當資料流程已初始化時, 這個屬性會設定為零。When a stream is initialized, this property is set to zero.

雖然您可以將資料流程的位置設定為超出資料流程的容量, 但您將無法使用ReadWrite方法來存取該區域。Although you can set the position of the stream beyond the stream's capacity, you will not be able to access that area using the Read and Write methods. Read會傳回 0, Write而且會NotSupportedException擲回。Read will return 0 and Write will throw a NotSupportedException. 這種支援主要是針對基本串流作業的設計和程式碼相容性。This support is primarily for design and code compatibility with basic stream operations.

適用於