DownloadStringCompletedEventArgs.Result Propiedad

Definición

Obtiene los datos descargados por un método DownloadStringAsync.

public:
 property System::String ^ Result { System::String ^ get(); };
public string Result { get; }
member this.Result : string
Public ReadOnly Property Result As String

Valor de propiedad

String

String que contiene los datos descargados.

Ejemplos

En el ejemplo de código siguiente se muestra el valor de esta propiedad.

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 == nullptr )
   {
      String^ textString = dynamic_cast<String^>(e->Result);
      Console::WriteLine( textString );
   }
}
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

Comentarios

Debe comprobar las Error propiedades y Cancelled antes de usar los datos devueltos por esta propiedad. Si el valor de la Error propiedad es un Exception objeto o el valor de la Cancelled propiedad es true, la operación asincrónica no se completó correctamente y el valor de la Result propiedad no será válido.

Se aplica a