Partager via


HttpClientExtensions Class

Extension methods that aid in making formatted requests using HttpClient.

Inheritance Hierarchy

System.Object
  System.Net.Http.HttpClientExtensions

Namespace:  System.Net.Http
Assembly:  System.Net.Http.Formatting (in System.Net.Http.Formatting.dll)

Syntax

'Declaration
<ExtensionAttribute> _
Public NotInheritable Class HttpClientExtensions
'Usage
public static class HttpClientExtensions
[ExtensionAttribute]
public ref class HttpClientExtensions abstract sealed
[<AbstractClassAttribute>]
[<SealedAttribute>]
type HttpClientExtensions =  class end
public final class HttpClientExtensions

Methods

  Name Description
Public methodStatic member PostAsJsonAsync<T>(HttpClient, String, T) Sends a POST request as an asynchronous operation, with a specified value serialized as JSON.
Public methodStatic member PostAsJsonAsync<T>(HttpClient, String, T, CancellationToken) Sends a POST request as an asynchronous operation, with a specified value serialized as JSON. Includes a cancellation token to cancel the request.
Public methodStatic member PostAsXmlAsync<T>(HttpClient, String, T) Sends a POST request as an asynchronous operation, with a specified value serialized as XML.
Public methodStatic member PostAsXmlAsync<T>(HttpClient, String, T, CancellationToken) Sends a POST request as an asynchronous operation, with a specified value serialized as XML. Includes a cancellation token to cancel the request.
Public methodStatic member PostAsync<T>(HttpClient, String, T, MediaTypeFormatter) Sends a POST request as an asynchronous operation, with a specified value serialized using the given formatter.
Public methodStatic member PostAsync<T>(HttpClient, String, T, MediaTypeFormatter, String) Sends a POST request as an asynchronous operation, with a specified value serialized using the given formatter and media type string.
Public methodStatic member PostAsync<T>(HttpClient, String, T, MediaTypeFormatter, CancellationToken) Sends a POST request as an asynchronous operation, with a specified value serialized using the given formatter. Includes a cancellation token to cancel the request.
Public methodStatic member PostAsync<T>(HttpClient, String, T, MediaTypeFormatter, MediaTypeHeaderValue, CancellationToken) Sends a POST request as an asynchronous operation, with a specified value serialized using the given formatter and media type.
Public methodStatic member PostAsync<T>(HttpClient, String, T, MediaTypeFormatter, String, CancellationToken) Sends a POST request as an asynchronous operation, with a specified value serialized using the given formatter and media type string. Includes a cancellation token to cancel the request.
Public methodStatic member PutAsJsonAsync<T>(HttpClient, String, T) Sends a PUT request as an asynchronous operation, with a specified value serialized as JSON.
Public methodStatic member PutAsJsonAsync<T>(HttpClient, String, T, CancellationToken) Sends a PUT request as an asynchronous operation, with a specified value serialized as JSON. Includes a cancellation token to cancel the request.
Public methodStatic member PutAsXmlAsync<T>(HttpClient, String, T) Sends a PUT request as an asynchronous operation, with a specified value serialized as XML.
Public methodStatic member PutAsXmlAsync<T>(HttpClient, String, T, CancellationToken) Sends a PUT request as an asynchronous operation, with a specified value serialized as XML. Includes a cancellation token to cancel the request.
Public methodStatic member PutAsync<T>(HttpClient, String, T, MediaTypeFormatter) Sends a PUT request as an asynchronous operation, with a specified value serialized using the given formatter.
Public methodStatic member PutAsync<T>(HttpClient, String, T, MediaTypeFormatter, String) Sends a PUT request as an asynchronous operation, with a specified value serialized using the given formatter and media type string.
Public methodStatic member PutAsync<T>(HttpClient, String, T, MediaTypeFormatter, CancellationToken) Sends a PUT request as an asynchronous operation, with a specified value serialized using the given formatter and medai type string. Includes a cancellation token to cancel the request.
Public methodStatic member PutAsync<T>(HttpClient, String, T, MediaTypeFormatter, MediaTypeHeaderValue, CancellationToken) Sends a PUT request as an asynchronous operation, with a specified value serialized using the given formatter and media type. Includes a cancellation token to cancel the request.
Public methodStatic member PutAsync<T>(HttpClient, String, T, MediaTypeFormatter, String, CancellationToken) Sends a PUT request as an asynchronous operation, with a specified value serialized using the given formatter and media type string. Includes a cancellation token to cancel the request.

Top

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

System.Net.Http Namespace