HttpClient.GetByteArrayAsync 方法

定义

将 GET 请求发送到指定 URI 并在异步操作中以字节数组的形式返回响应正文。Send a GET request to the specified Uri and return the response body as a byte array in an asynchronous operation.

重载

GetByteArrayAsync(Uri)

将 GET 请求发送到指定 URI 并在异步操作中以字节数组的形式返回响应正文。Send a GET request to the specified Uri and return the response body as a byte array in an asynchronous operation.

GetByteArrayAsync(String)

将 GET 请求发送到指定 URI 并在异步操作中以字节数组的形式返回响应正文。Sends a GET request to the specified Uri and return the response body as a byte array in an asynchronous operation.

注解

操作不会阻止。The operation will not block.

GetByteArrayAsync(Uri)

将 GET 请求发送到指定 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<cli::array <System::Byte> ^> ^ GetByteArrayAsync(Uri ^ requestUri);
public System.Threading.Tasks.Task<byte[]> GetByteArrayAsync (Uri requestUri);
member this.GetByteArrayAsync : Uri -> System.Threading.Tasks.Task<byte[]>
Public Function GetByteArrayAsync (requestUri As Uri) As Task(Of Byte())

参数

requestUri
Uri

将请求发送到的 Uri。The Uri the request is sent to.

返回

Task<Byte[]>

表示异步操作的任务对象。The task object representing the asynchronous operation.

异常

requestUrinullThe requestUri is null.

由于基础问题(如网络连接性、DNS 失败、服务器证书验证或超时),请求失败。The request failed due to an underlying issue such as network connectivity, DNS failure, server certificate validation or timeout.

注解

此操作不会阻止。This operation will not block. 在读取整个响应正文后,将完成返回的 Task<TResult> 对象。The returned Task<TResult> object will complete after the whole response body is read.

GetByteArrayAsync(String)

将 GET 请求发送到指定 URI 并在异步操作中以字节数组的形式返回响应正文。Sends 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<cli::array <System::Byte> ^> ^ GetByteArrayAsync(System::String ^ requestUri);
public System.Threading.Tasks.Task<byte[]> GetByteArrayAsync (string requestUri);
member this.GetByteArrayAsync : string -> System.Threading.Tasks.Task<byte[]>
Public Function GetByteArrayAsync (requestUri As String) As Task(Of Byte())

参数

requestUri
String

将请求发送到的 Uri。The Uri the request is sent to.

返回

Task<Byte[]>

表示异步操作的任务对象。The task object representing the asynchronous operation.

异常

requestUrinullThe requestUri is null.

由于基础问题(如网络连接性、DNS 失败、服务器证书验证或超时),请求失败。The request failed due to an underlying issue such as network connectivity, DNS failure, server certificate validation or timeout.

注解

此操作不会阻止。This operation will not block. 在读取整个响应正文后,将完成返回的 Task<TResult> 对象。The returned Task<TResult> object will complete after the whole response body is read.

适用于