Bagikan melalui


IsolatedStorageFileStream.CanRead Properti

Definisi

Mendapatkan nilai Boolean yang menunjukkan apakah file dapat dibaca.

public:
 virtual property bool CanRead { bool get(); };
public override bool CanRead { get; }
member this.CanRead : bool
Public Overrides ReadOnly Property CanRead As Boolean

Nilai Properti

true IsolatedStorageFileStream jika objek dapat dibaca; jika tidak, false.

Contoh

Contoh kode berikut menunjukkan bagaimana Anda dapat menggunakan CanRead properti , sebagai pemeriksaan untuk melihat apakah aliran dapat dibaca sebelum memanggil Read metode atau BeginRead . Untuk konteks lengkap contoh ini, lihat IsolatedStorageFileStream gambaran umum.

// This is the stream to which data will be written.
IsolatedStorageFileStream^ source = gcnew IsolatedStorageFileStream( this->userName,FileMode::OpenOrCreate,isoFile );

// This is the stream from which data will be read.
Console::WriteLine( "Is the source file readable?  {0}", (source->CanRead ? (String^)"true" : "false") );
Console::WriteLine( "Creating new IsolatedStorageFileStream for Archive." );

// Open or create a writable file.
IsolatedStorageFileStream^ target = gcnew IsolatedStorageFileStream( String::Concat("Archive\\",this->userName),FileMode::OpenOrCreate,FileAccess::Write,FileShare::Write,isoFile );

IsolatedStorageFileStream source =
    new IsolatedStorageFileStream(this.userName, FileMode.OpenOrCreate,
    isoFile);
// This is the stream from which data will be read.
Console.WriteLine("Is the source file readable? " + (source.CanRead ? "true" : "false"));
Console.WriteLine("Creating new IsolatedStorageFileStream for Archive.");

// Open or create a writable file.
IsolatedStorageFileStream target =
    new IsolatedStorageFileStream("Archive\\ " + this.userName,
    FileMode.OpenOrCreate,
    FileAccess.Write,
    FileShare.Write,
    isoFile);
' Open or create a writable file.
Dim target As New IsolatedStorageFileStream("Archive\ " & Me.userName, _
     FileMode.OpenOrCreate, FileAccess.Write, FileShare.Write, isoFile)

Keterangan

Gunakan properti ini untuk menentukan apakah IsolatedStorageFileStream objek dapat dibaca.

Berlaku untuk