Op Englesch liesen Editéieren

Deelen iwwer


IsolatedStorageFileStream.CanRead Property

Definition

Gets a Boolean value indicating whether the file can be read.

C#
public override bool CanRead { get; }

Property Value

true if an IsolatedStorageFileStream object can be read; otherwise, false.

Examples

The following code example demonstrates how you could use the CanRead property, as a check to see whether a stream can be read before calling the Read or BeginRead methods. For the complete context of this example, see the IsolatedStorageFileStream overview.

C#

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

Remarks

Use this property to determine whether the IsolatedStorageFileStream object can be read.

Applies to

Produkt Versiounen
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1
UWP 10.0