共用方式為


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

備註

您應該先檢查 和 Cancelled 屬性,Error再使用這個屬性所傳回的數據。 Error如果屬性值為 Exception 物件,或Cancelled屬性值為 true,則異步操作未正確完成,且Result屬性值無效。

適用於