MemoryStream.Position 属性

定义

获取或设置流中的当前位置。

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

属性值

流中的当前位置。

例外

位置设置为负值或大于 Int32.MaxValue 的值

流已关闭。

示例

此代码示例是为 MemoryStream 类提供的一个更大示例的一部分。

// 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())

适用于

另请参阅