共用方式為


UploadStringCompletedEventArgs.Result 屬性

定義

取得伺服器對字串上傳作業 (呼叫 UploadStringAsync 方法所啟動) 的回應。

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

屬性值

Byte 陣列,包含伺服器回應。

範例

下列程式代碼範例會顯示這個屬性的值。

void UploadStringCallback2( Object^ /*sender*/, UploadStringCompletedEventArgs^ e )
{
   String^ reply = dynamic_cast<String^>(e->Result);
   Console::WriteLine( reply );
}
private static void UploadStringCallback2(Object sender, UploadStringCompletedEventArgs e)
{
    string reply = (string)e.Result;
    Console.WriteLine(reply);
}
Private Shared Sub UploadStringCallback2(ByVal sender As Object, ByVal e As UploadStringCompletedEventArgs)
    Dim reply As String = CStr(e.Result)
    Console.WriteLine(reply)
End Sub

備註

您應該檢查 ErrorCancelled 屬性,以判斷上傳是否已完成。 Error如果屬性值為 Exception 物件,或Cancelled屬性值為 true,則異步操作未正確完成,且Result屬性值無效。

適用於