DownloadStringCompletedEventArgs.Result プロパティ
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
DownloadStringAsync メソッドによってダウンロードされたデータを取得します。
public:
property System::String ^ Result { System::String ^ get(); };
public string Result { get; }
member this.Result : string
Public ReadOnly Property Result As String
プロパティ値
ダウンロードしたデータを含む String 。
例
次のコード例では、このプロパティの値を表示します。
private static void DownloadStringCallback2(Object sender, DownloadStringCompletedEventArgs e)
{
// If the request was not canceled and did not throw
// an exception, display the resource.
if (!e.Cancelled && e.Error == null)
{
string textString = (string)e.Result;
Console.WriteLine(textString);
}
}
Private Shared Sub DownloadStringCallback2(ByVal sender As Object, ByVal e As DownloadStringCompletedEventArgs)
' If the request was not canceled and did not throw
' an exception, display the resource.
If e.Cancelled = False AndAlso e.Error Is Nothing Then
Dim textString As String = CStr(e.Result)
Console.WriteLine(textString)
End If
End Sub
注釈
このプロパティによって返されるデータを使用する前に、 Error プロパティと Cancelled プロパティを確認する必要があります。
Error プロパティの値がException オブジェクトであるか、Cancelled プロパティの値がtrueされている場合、非同期操作が正しく完了せず、Result プロパティの値が無効になります。