HttpClient.GetByteArrayAsync Method

Definition

Send a GET request to the specified Uri and return the response body as a byte array in an asynchronous operation.

Overloads

GetByteArrayAsync(Uri)

Send a GET request to the specified Uri and return the response body as a byte array in an asynchronous operation.

GetByteArrayAsync(String)

Send a GET request to the specified Uri and return the response body as a byte array in an asynchronous operation.

Remarks

The operation will not block.

GetByteArrayAsync(Uri)

Send a GET request to the specified Uri and return the response body as a byte array in an asynchronous operation.

public System.Threading.Tasks.Task<byte[]> GetByteArrayAsync (Uri requestUri);
Parameters
requestUri
Uri

The Uri the request is sent to.

Returns
Task<Byte[]>

The task object representing the asynchronous operation.

Exceptions

The requestUri is null.

The request failed due to an underlying issue such as network connectivity, DNS failure, server certificate validation or timeout.

Remarks

This operation will not block. The returned Task<TResult> object will complete after the whole response body is read.

GetByteArrayAsync(String)

Send a GET request to the specified Uri and return the response body as a byte array in an asynchronous operation.

public System.Threading.Tasks.Task<byte[]> GetByteArrayAsync (string requestUri);
Parameters
requestUri
String

The Uri the request is sent to.

Returns
Task<Byte[]>

The task object representing the asynchronous operation.

Exceptions

The requestUri is null.

The request failed due to an underlying issue such as network connectivity, DNS failure, server certificate validation or timeout.

Remarks

This operation will not block. The returned Task<TResult> object will complete after the whole response body is read.

Applies to