Udostępnij przez


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

true IsolatedStorageFileStream jeśli obiekt może być odczytywany; w przeciwnym razie false.

Przykłady

Poniższy przykład kodu pokazuje, jak można użyć CanRead właściwości, jako sprawdzenie, czy strumień można odczytać przed wywołaniem Read metod lub BeginRead . Pełny kontekst tego przykładu zawiera omówienie IsolatedStorageFileStream .


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