다음을 통해 공유


OpenWriteCompletedEventArgs.Result 속성

정의

서버에 데이터를 보내는 데 사용되는 쓰기 가능한 스트림을 가져옵니다.

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 업로드할 데이터를 쓸 수 있는 위치입니다.

예제

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

private static void OpenWriteCallback2(Object sender, OpenWriteCompletedEventArgs e)
{
    Stream body = null;
    StreamWriter s = null;

    try
    {
        body = (Stream)e.Result;
        s = new StreamWriter(body);
        s.AutoFlush = true;
        s.Write("This is content data to be sent to the server.");
    }
    finally
    {
        if (s != null)
        {
            s.Close();
        }

        if (body != null)
        {
            body.Close();
        }
    }
}
Private Shared Sub OpenWriteCallback2(ByVal sender As Object, ByVal e As OpenWriteCompletedEventArgs)

    Dim body As Stream = Nothing
    Dim s As StreamWriter = Nothing

    Try

        body = CType(e.Result, Stream)
        s = New StreamWriter(body)
        s.AutoFlush = True
        s.Write("This is content data to be sent to the server.")
    Finally

        If Not s Is Nothing Then

            s.Close()
        End If

        If Not body Is Nothing Then

            body.Close()
        End If
    End Try
End Sub

설명

이 속성에서 반환된 스트림을 Error 사용하기 전에 해당 속성과 Cancelled 속성을 확인해야 합니다. 속성 값이 ErrorException 개체이거나 Cancelled 속성 값이 true면 비동기 작업이 제대로 Result 완료되지 않았으며 속성 값이 유효하지 않습니다.

적용 대상