Olvasás angol nyelven Szerkesztés

Megosztás a következőn keresztül:


HttpClientJsonExtensions.PutAsJsonAsync Method

Definition

Overloads

PutAsJsonAsync<TValue>(HttpClient, Uri, TValue, JsonSerializerOptions, CancellationToken)

Send a PUT request to the specified Uri containing the value serialized as JSON in the request body.

PutAsJsonAsync<TValue>(HttpClient, String, TValue, CancellationToken)

Send a PUT request to the specified Uri containing the value serialized as JSON in the request body.

PutAsJsonAsync<TValue>(HttpClient, Uri, TValue, CancellationToken)

Send a PUT request to the specified Uri containing the value serialized as JSON in the request body.

PutAsJsonAsync<TValue>(HttpClient, String, TValue, JsonSerializerOptions, CancellationToken)

Send a PUT request to the specified Uri containing the value serialized as JSON in the request body.

PutAsJsonAsync<TValue>(HttpClient, String, TValue, JsonTypeInfo<TValue>, CancellationToken)

Send a PUT request to the specified Uri containing the value serialized as JSON in the request body.

PutAsJsonAsync<TValue>(HttpClient, Uri, TValue, JsonTypeInfo<TValue>, CancellationToken)

Send a PUT request to the specified Uri containing the value serialized as JSON in the request body.

PutAsJsonAsync<TValue>(HttpClient, Uri, TValue, JsonSerializerOptions, CancellationToken)

Source:
HttpClientJsonExtensions.Put.cs
Source:
HttpClientJsonExtensions.Put.cs
Source:
HttpClientJsonExtensions.Put.cs
Source:
HttpClientJsonExtensions.Put.cs
Source:
HttpClientJsonExtensions.Put.cs

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

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)

PutAsJsonAsync<TValue>(HttpClient, String, TValue, CancellationToken)

Source:
HttpClientJsonExtensions.Put.cs
Source:
HttpClientJsonExtensions.Put.cs
Source:
HttpClientJsonExtensions.Put.cs
Source:
HttpClientJsonExtensions.Put.cs
Source:
HttpClientJsonExtensions.Put.cs

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.Threading.CancellationToken cancellationToken);

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)

PutAsJsonAsync<TValue>(HttpClient, Uri, TValue, CancellationToken)

Source:
HttpClientJsonExtensions.Put.cs
Source:
HttpClientJsonExtensions.Put.cs
Source:
HttpClientJsonExtensions.Put.cs
Source:
HttpClientJsonExtensions.Put.cs
Source:
HttpClientJsonExtensions.Put.cs

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.Threading.CancellationToken cancellationToken);

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)

PutAsJsonAsync<TValue>(HttpClient, String, TValue, JsonSerializerOptions, CancellationToken)

Source:
HttpClientJsonExtensions.Put.cs
Source:
HttpClientJsonExtensions.Put.cs
Source:
HttpClientJsonExtensions.Put.cs
Source:
HttpClientJsonExtensions.Put.cs
Source:
HttpClientJsonExtensions.Put.cs

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

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)

PutAsJsonAsync<TValue>(HttpClient, String, TValue, JsonTypeInfo<TValue>, CancellationToken)

Source:
HttpClientJsonExtensions.Put.cs
Source:
HttpClientJsonExtensions.Put.cs
Source:
HttpClientJsonExtensions.Put.cs
Source:
HttpClientJsonExtensions.Put.cs
Source:
HttpClientJsonExtensions.Put.cs

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

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)

PutAsJsonAsync<TValue>(HttpClient, Uri, TValue, JsonTypeInfo<TValue>, CancellationToken)

Source:
HttpClientJsonExtensions.Put.cs
Source:
HttpClientJsonExtensions.Put.cs
Source:
HttpClientJsonExtensions.Put.cs
Source:
HttpClientJsonExtensions.Put.cs
Source:
HttpClientJsonExtensions.Put.cs

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

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)