MemoryStream.Position 屬性

定義

取得或設定資料流中目前的位置。Gets or sets the current position within the 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 within the stream.

例外狀況

位置設為負數值或大於 MaxValue 的值。The position is set to a negative value or a value greater than MaxValue.

資料流已關閉。The stream is closed.

範例

這個程式碼範例是針對MemoryStream類別提供之較大範例的一部分。This code example is part of a larger example provided for the MemoryStream class.

// Write the stream properties to the console.
Console::WriteLine( "Capacity = {0}, Length = {1}, "
"Position = {2}\n", memStream->Capacity.ToString(), memStream->Length.ToString(), memStream->Position.ToString() );
// Write the stream properties to the console.
Console.WriteLine(
    "Capacity = {0}, Length = {1}, Position = {2}\n",
    memStream.Capacity.ToString(),
    memStream.Length.ToString(),
    memStream.Position.ToString());
' Write the stream properties to the console.
Console.WriteLine( _
    "Capacity = {0}, Length = {1}, Position = {2}", _
    memStream.Capacity.ToString(), _
    memStream.Length.ToString(), _
    memStream.Position.ToString())

適用於

另請參閱