DownloadDataCompletedEventArgs.Result 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
DownloadDataAsync 메서드로 다운로드한 데이터를 가져옵니다.
public:
property cli::array <System::Byte> ^ Result { cli::array <System::Byte> ^ get(); };
public byte[] Result { get; }
member this.Result : byte[]
Public ReadOnly Property Result As Byte()
속성 값
다운로드한 데이터가 들어 있는 Byte 배열입니다.
예제
다음 코드 예제에서는이 속성의 값을 표시합니다.
private static void DownloadDataCallback(Object sender, DownloadDataCompletedEventArgs e)
{
System.Threading.AutoResetEvent waiter = (System.Threading.AutoResetEvent)e.UserState;
try
{
// If the request was not canceled and did not throw
// an exception, display the resource.
if (!e.Cancelled && e.Error == null)
{
byte[] data = (byte[])e.Result;
string textData = System.Text.Encoding.UTF8.GetString(data);
Console.WriteLine(textData);
}
}
finally
{
// Let the main application thread resume.
waiter.Set();
}
}
Private Shared Sub DownloadDataCallback(ByVal sender As Object, ByVal e As DownloadDataCompletedEventArgs)
Dim waiter As System.Threading.AutoResetEvent = CType(e.UserState, System.Threading.AutoResetEvent)
Try
' 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 data() As Byte = CType(e.Result, Byte())
Dim textData As String = System.Text.Encoding.UTF8.GetString(data)
Console.WriteLine(textData)
End If
Finally
' Let the main application thread resume.
waiter.Set()
End Try
End Sub
설명
확인 해야 합니다 Error 및 Cancelled 이 속성에 의해 반환 되는 데이터를 사용 하기 전에 속성입니다. 경우는 Error 속성의 값이를 Exception 개체 또는 Cancelled 속성의 값이 true, 비동기 작업이 제대로 완료 되지 않은 및 Result 속성의 값을 유효 하지 않게 됩니다.