IsolatedStorageFileStream.Position 屬性

定義

取得或設定目前 IsolatedStorageFileStream 物件目前的位置。

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

屬性值

這個 IsolatedStorageFileStream 物件的目前位置。

例外狀況

不能將位置設定為負數。

範例

下列程式代碼範例會 Position 使用 屬性將數據寫入檔案。

Console::WriteLine( "Writing data to the new file." );
while ( source->Position < source->Length )
{
   inputChar = (Byte)source->ReadByte();
   target->WriteByte( (Byte)source->ReadByte() );
}

// Determine the size of the IsolatedStorageFileStream
// by checking its Length property.
Console::WriteLine( "Total Bytes Read: {0}", source->Length.ToString() );
Console.WriteLine("Writing data to the new file.");
while (source.Position < source.Length)
{
    inputChar = (byte)source.ReadByte();
    target.WriteByte(inputChar);
}

// Determine the size of the IsolatedStorageFileStream
// by checking its Length property.
Console.WriteLine("Total Bytes Read: " + source.Length);
Console.WriteLine("Writing data to the new file.")
While source.Position < source.Length
    inputChar = CByte(source.ReadByte())
    target.WriteByte(inputChar)
End While

' Determine the size of the IsolatedStorageFileStream
' by checking its Length property.
Console.WriteLine(("Total Bytes Read: " & source.Length))

備註

當 屬性為 true時,CanSeek設定這個屬性會正常運作。

適用於