IsolatedStorageFileStream.CanRead Właściwość

Definicja

Pobiera wartość logiczną wskazującą, czy plik można odczytać.

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

Wartość właściwości

Boolean

trueIsolatedStorageFileStream jeśli można odczytać obiekt; w przeciwnym razie false.

Przykłady

W poniższym przykładzie kodu pokazano, jak można użyć CanRead właściwości jako sprawdzenie, czy strumień można odczytać przed wywołaniem Read metody lub BeginRead . Pełny kontekst tego przykładu IsolatedStorageFileStream zawiera omówienie.

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

Uwagi

Użyj tej właściwości, aby określić, czy IsolatedStorageFileStream obiekt można odczytać.

Dotyczy