HttpClientJsonExtensions.PutAsJsonAsync Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
PutAsJsonAsync<TValue>(HttpClient, Uri, TValue, JsonSerializerOptions, CancellationToken) |
Send a PUT request to the specified Uri containing the |
PutAsJsonAsync<TValue>(HttpClient, String, TValue, CancellationToken) |
Send a PUT request to the specified Uri containing the |
PutAsJsonAsync<TValue>(HttpClient, Uri, TValue, CancellationToken) |
Send a PUT request to the specified Uri containing the |
PutAsJsonAsync<TValue>(HttpClient, String, TValue, JsonSerializerOptions, CancellationToken) |
Send a PUT request to the specified Uri containing the |
PutAsJsonAsync<TValue>(HttpClient, String, TValue, JsonTypeInfo<TValue>, CancellationToken) |
Send a PUT request to the specified Uri containing the |
PutAsJsonAsync<TValue>(HttpClient, Uri, TValue, JsonTypeInfo<TValue>, CancellationToken) |
Send a PUT request to the specified Uri containing the |
Send a PUT request to the specified Uri containing the value
serialized as JSON in the request body.
public static System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PutAsJsonAsync<TValue> (this System.Net.Http.HttpClient client, Uri? requestUri, TValue value, System.Text.Json.JsonSerializerOptions? options = default, System.Threading.CancellationToken cancellationToken = default);
static member PutAsJsonAsync : System.Net.Http.HttpClient * Uri * 'Value * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage>
<Extension()>
Public Function PutAsJsonAsync(Of TValue) (client As HttpClient, requestUri As Uri, value As TValue, Optional options As JsonSerializerOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of HttpResponseMessage)
Type Parameters
- TValue
The type of the value to serialize.
Parameters
- client
- HttpClient
The client used to send the request.
- requestUri
- Uri
The Uri the request is sent to.
- value
- TValue
The value to serialize.
- options
- JsonSerializerOptions
Options to control the behavior during serialization. The default options are those specified by Web.
- cancellationToken
- CancellationToken
A cancellation token that can be used by other objects or threads to receive notice of cancellation.
Returns
The task object representing the asynchronous operation.
Exceptions
The cancellation token was canceled. This exception is stored into the returned task.
Applies to
.NET 9 és más verziók
Termék | Verziók |
---|---|
.NET | 5, 6, 7, 8 (package-provided), 8, 9 (package-provided), 9 |
.NET Framework | 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided) |
.NET Standard | 2.0 (package-provided) |
Send a PUT request to the specified Uri containing the value
serialized as JSON in the request body.
public:
generic <typename TValue>
[System::Runtime::CompilerServices::Extension]
static System::Threading::Tasks::Task<System::Net::Http::HttpResponseMessage ^> ^ PutAsJsonAsync(System::Net::Http::HttpClient ^ client, System::String ^ requestUri, TValue value, System::Threading::CancellationToken cancellationToken);
public static System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PutAsJsonAsync<TValue> (this System.Net.Http.HttpClient client, string? requestUri, TValue value, System.Threading.CancellationToken cancellationToken);
static member PutAsJsonAsync : System.Net.Http.HttpClient * string * 'Value * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage>
<Extension()>
Public Function PutAsJsonAsync(Of TValue) (client As HttpClient, requestUri As String, value As TValue, cancellationToken As CancellationToken) As Task(Of HttpResponseMessage)
Type Parameters
- TValue
The type of the value to serialize.
Parameters
- client
- HttpClient
The client used to send the request.
- requestUri
- String
The Uri the request is sent to.
- value
- TValue
The value to serialize.
- cancellationToken
- CancellationToken
A cancellation token that can be used by other objects or threads to receive notice of cancellation.
Returns
The task object representing the asynchronous operation.
Exceptions
The cancellation token was canceled. This exception is stored into the returned task.
Remarks
This method uses JsonSerializerDefaults.Web options for serialization, whereas JsonSerializer serialization methods do not, by default.
Applies to
.NET 9 és más verziók
Termék | Verziók |
---|---|
.NET | 5, 6, 7, 8 (package-provided), 8, 9 (package-provided), 9 |
.NET Framework | 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided) |
.NET Standard | 2.0 (package-provided) |
Send a PUT request to the specified Uri containing the value
serialized as JSON in the request body.
public:
generic <typename TValue>
[System::Runtime::CompilerServices::Extension]
static System::Threading::Tasks::Task<System::Net::Http::HttpResponseMessage ^> ^ PutAsJsonAsync(System::Net::Http::HttpClient ^ client, Uri ^ requestUri, TValue value, System::Threading::CancellationToken cancellationToken);
public static System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PutAsJsonAsync<TValue> (this System.Net.Http.HttpClient client, Uri? requestUri, TValue value, System.Threading.CancellationToken cancellationToken);
static member PutAsJsonAsync : System.Net.Http.HttpClient * Uri * 'Value * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage>
<Extension()>
Public Function PutAsJsonAsync(Of TValue) (client As HttpClient, requestUri As Uri, value As TValue, cancellationToken As CancellationToken) As Task(Of HttpResponseMessage)
Type Parameters
- TValue
The type of the value to serialize.
Parameters
- client
- HttpClient
The client used to send the request.
- requestUri
- Uri
The Uri the request is sent to.
- value
- TValue
The value to serialize.
- cancellationToken
- CancellationToken
A cancellation token that can be used by other objects or threads to receive notice of cancellation.
Returns
The task object representing the asynchronous operation.
Exceptions
The cancellation token was canceled. This exception is stored into the returned task.
Remarks
This method uses JsonSerializerDefaults.Web options for serialization, whereas JsonSerializer serialization methods do not, by default.
Applies to
.NET 9 és más verziók
Termék | Verziók |
---|---|
.NET | 5, 6, 7, 8 (package-provided), 8, 9 (package-provided), 9 |
.NET Framework | 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided) |
.NET Standard | 2.0 (package-provided) |
Send a PUT request to the specified Uri containing the value
serialized as JSON in the request body.
public static System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PutAsJsonAsync<TValue> (this System.Net.Http.HttpClient client, string? requestUri, TValue value, System.Text.Json.JsonSerializerOptions? options = default, System.Threading.CancellationToken cancellationToken = default);
static member PutAsJsonAsync : System.Net.Http.HttpClient * string * 'Value * System.Text.Json.JsonSerializerOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage>
<Extension()>
Public Function PutAsJsonAsync(Of TValue) (client As HttpClient, requestUri As String, value As TValue, Optional options As JsonSerializerOptions = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of HttpResponseMessage)
Type Parameters
- TValue
The type of the value to serialize.
Parameters
- client
- HttpClient
The client used to send the request.
- requestUri
- String
The Uri the request is sent to.
- value
- TValue
The value to serialize.
- options
- JsonSerializerOptions
Options to control the behavior during serialization. The default options are those specified by Web.
- cancellationToken
- CancellationToken
A cancellation token that can be used by other objects or threads to receive notice of cancellation.
Returns
The task object representing the asynchronous operation.
Exceptions
The cancellation token was canceled. This exception is stored into the returned task.
Applies to
.NET 9 és más verziók
Termék | Verziók |
---|---|
.NET | 5, 6, 7, 8 (package-provided), 8, 9 (package-provided), 9 |
.NET Framework | 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided) |
.NET Standard | 2.0 (package-provided) |
Send a PUT request to the specified Uri containing the value
serialized as JSON in the request body.
public static System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PutAsJsonAsync<TValue> (this System.Net.Http.HttpClient client, string? requestUri, TValue value, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TValue> jsonTypeInfo, System.Threading.CancellationToken cancellationToken = default);
static member PutAsJsonAsync : System.Net.Http.HttpClient * string * 'Value * System.Text.Json.Serialization.Metadata.JsonTypeInfo<'Value> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage>
<Extension()>
Public Function PutAsJsonAsync(Of TValue) (client As HttpClient, requestUri As String, value As TValue, jsonTypeInfo As JsonTypeInfo(Of TValue), Optional cancellationToken As CancellationToken = Nothing) As Task(Of HttpResponseMessage)
Type Parameters
- TValue
The type of the value to serialize.
Parameters
- client
- HttpClient
The client used to send the request.
- requestUri
- String
The Uri the request is sent to.
- value
- TValue
The value to serialize.
- jsonTypeInfo
- JsonTypeInfo<TValue>
The JsonTypeInfo used to control the serialization behavior.
- cancellationToken
- CancellationToken
A cancellation token that can be used by other objects or threads to receive notice of cancellation.
Returns
The task object representing the asynchronous operation.
Exceptions
The cancellation token was canceled. This exception is stored into the returned task.
Applies to
.NET 9 és más verziók
Termék | Verziók |
---|---|
.NET | 6, 7, 8 (package-provided), 8, 9 (package-provided), 9 |
.NET Framework | 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided) |
.NET Standard | 2.0 (package-provided) |
Send a PUT request to the specified Uri containing the value
serialized as JSON in the request body.
public static System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage> PutAsJsonAsync<TValue> (this System.Net.Http.HttpClient client, Uri? requestUri, TValue value, System.Text.Json.Serialization.Metadata.JsonTypeInfo<TValue> jsonTypeInfo, System.Threading.CancellationToken cancellationToken = default);
static member PutAsJsonAsync : System.Net.Http.HttpClient * Uri * 'Value * System.Text.Json.Serialization.Metadata.JsonTypeInfo<'Value> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<System.Net.Http.HttpResponseMessage>
<Extension()>
Public Function PutAsJsonAsync(Of TValue) (client As HttpClient, requestUri As Uri, value As TValue, jsonTypeInfo As JsonTypeInfo(Of TValue), Optional cancellationToken As CancellationToken = Nothing) As Task(Of HttpResponseMessage)
Type Parameters
- TValue
The type of the value to serialize.
Parameters
- client
- HttpClient
The client used to send the request.
- requestUri
- Uri
The Uri the request is sent to.
- value
- TValue
The value to serialize.
- jsonTypeInfo
- JsonTypeInfo<TValue>
The JsonTypeInfo used to control the serialization behavior.
- cancellationToken
- CancellationToken
A cancellation token that can be used by other objects or threads to receive notice of cancellation.
Returns
The task object representing the asynchronous operation.
Exceptions
The cancellation token was canceled. This exception is stored into the returned task.
Applies to
.NET 9 és más verziók
Termék | Verziók |
---|---|
.NET | 6, 7, 8 (package-provided), 8, 9 (package-provided), 9 |
.NET Framework | 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided) |
.NET Standard | 2.0 (package-provided) |
.NET-visszajelzés
A(z) .NET egy nyílt forráskód projekt. Visszajelzés adásához válasszon egy hivatkozást: