OpenReadCompletedEventArgs.Result 속성

정의

DownloadDataAsync 메서드로 다운로드한 데이터가 들어 있는 읽기 가능한 스트림을 가져옵니다.

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

속성 값

다운로드한 데이터가 들어 있는 Stream입니다.

예제

다음 코드 예제에서는이 속성에 의해 반환 된 스트림을 사용 합니다.

void OpenReadCallback2( Object^ /*sender*/, OpenReadCompletedEventArgs^ e )
{
   Stream^ reply = nullptr;
   StreamReader^ s = nullptr;
   try
   {
      reply = dynamic_cast<Stream^>(e->Result);
      s = gcnew StreamReader( reply );
      Console::WriteLine( s->ReadToEnd() );
   }
   finally
   {
      if ( s != nullptr )
      {
         s->Close();
      }
      if ( reply != nullptr )
      {
         reply->Close();
      }
   }

}
private static void OpenReadCallback2(Object sender, OpenReadCompletedEventArgs e)
{
    Stream reply = null;
    StreamReader s = null;

    try
    {
        reply = (Stream)e.Result;
        s = new StreamReader(reply);
        Console.WriteLine(s.ReadToEnd());
    }
    finally
    {
        if (s != null)
        {
            s.Close();
        }

        if (reply != null)
        {
            reply.Close();
        }
    }
}
Private Shared Sub OpenReadCallback2(ByVal sender As Object, ByVal e As OpenReadCompletedEventArgs)

    Dim reply As Stream = Nothing
    Dim s As StreamReader = Nothing

    Try

        reply = CType(e.Result, Stream)
        s = New StreamReader(reply)
        Console.WriteLine(s.ReadToEnd())
    Finally

        If Not s Is Nothing Then

            s.Close()
        End If

        If Not reply Is Nothing Then

            reply.Close()
        End If
    End Try
End Sub

설명

확인 해야 합니다 ErrorCancelled 이 속성에 의해 반환 되는 데이터를 사용 하기 전에 속성입니다. 경우는 Error 속성의 값이를 Exception 개체 또는 Cancelled 속성의 값이 true, 비동기 작업이 제대로 완료 되지 않은 및 Result 속성의 값을 유효 하지 않게 됩니다.

적용 대상