IsolatedStorageFileStream.CanWrite 属性

定义

获取一个布尔值,该值指示是否可以写入文件。Gets a Boolean value indicating whether you can write to the file.

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

属性值

如果可以写入 true 对象,则为 IsolatedStorageFileStream;否则为 falsetrue if an IsolatedStorageFileStream object can be written; otherwise, false.

示例

下面的代码示例演示如何使用 CanWrite 属性,以查看在调用 WriteBeginWrite 方法之前是否可以读取流。The following code example demonstrates how you could use the CanWrite property, as a check to see whether a stream can be read before calling the Write or BeginWrite methods. 有关此示例的完整上下文,请参阅 IsolatedStorageFileStream 概述。For the complete context of this example, see the IsolatedStorageFileStream overview.

Console::WriteLine( "Is the target file writable? {0}", (target->CanWrite ? (String^)"true" : "false") );

Console.WriteLine("Is the target file writable? " + (target.CanWrite ? "true" : "false"));
If target.CanWrite Then canWrite = True Else canWrite = False
Console.WriteLine("Is the target file writable? " & canWrite)

注解

使用此属性来确定能否写入 IsolatedStorageFileStream 对象。Use this property to determine whether the IsolatedStorageFileStream object can be written.

适用于