共用方式為


SslStream.CanRead 屬性

定義

取得 Boolean 值,指示基礎資料流是否可讀取。

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

屬性值

如果執行了驗證且基礎資料流可讀取,則為 true,否則為 false

範例

下列程式代碼範例示範如何顯示這個屬性的值。

static void DisplayStreamProperties( SslStream^ stream )
{
   Console::WriteLine( L"Can read: {0}, write {1}", stream->CanRead, stream->CanWrite );
   Console::WriteLine( L"Can timeout: {0}", stream->CanTimeout );
}
static void DisplayStreamProperties(SslStream stream)
{
   Console.WriteLine("Can read: {0}, write {1}", stream.CanRead, stream.CanWrite);
   Console.WriteLine("Can timeout: {0}", stream.CanTimeout);
}
Private Shared Sub DisplayStreamProperties(stream As SslStream)
    Console.WriteLine("Can read: {0}, write {1}", stream.CanRead, stream.CanWrite)
    Console.WriteLine("Can timeout: {0}", stream.CanTimeout)
End Sub

備註

如果成功驗證發生,這個屬性會傳回叫用 CanRead 基礎數據流所傳回的值。

當您建立 類別的 SslStream 實例時,會指定基礎數據流。

適用於