UploadDataCompletedEventArgs.Result 属性

定义

获取通过调用 UploadDataAsync 方法启动的数据上载操作的服务器回复。

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[]

包含服务器回复的 Byte 数组。

示例

下面的代码示例显示此属性的值。

void UploadDataCallback2( Object^ /*sender*/, UploadDataCompletedEventArgs^ e )
{
   array<Byte>^data = dynamic_cast<array<Byte>^>(e->Result);
   String^ reply = System::Text::Encoding::UTF8->GetString( data );
   Console::WriteLine( reply );
}
private static void UploadDataCallback2(Object sender, UploadDataCompletedEventArgs e)
{
    byte[] data = (byte[])e.Result;
    string reply = System.Text.Encoding.UTF8.GetString(data);

    Console.WriteLine(reply);
}
Private Shared Sub UploadDataCallback2(ByVal sender As Object, ByVal e As UploadDataCompletedEventArgs)

    Dim data() As Byte = CType(e.Result, Byte())
    Dim reply As String = System.Text.Encoding.UTF8.GetString(data)

    Console.WriteLine(reply)
End Sub

注解

在使用此属性返回的数据之前,应检查 ErrorCancelled 属性。 Error如果属性的值为 Exception 对象或Cancelled属性的值为 true,则异步操作未正确完成,Result并且该属性的值将无效。

适用于