Редагувати

Поділитися через


UploadDataCompletedEventArgs.Result Property

Definition

Gets the server reply to a data upload operation started by calling an UploadDataAsync method.

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()

Property Value

Byte[]

A Byte array containing the server reply.

Examples

The following code example displays the value of this property.

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

Remarks

You should check the Error and Cancelled properties before using the data returned by this property. If the Error property's value is an Exception object or the Cancelled property's value is true, the asynchronous operation did not complete correctly and the Result property's value will not be valid.

Applies to