Olvasás angol nyelven Szerkesztés

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


JsonContent.Create Method

Definition

Overloads

Create(Object, JsonTypeInfo, MediaTypeHeaderValue)

Creates a new instance of the JsonContent class that will contain the inputValue serialized as JSON.

Create(Object, Type, MediaTypeHeaderValue, JsonSerializerOptions)

Creates a new instance of the JsonContent class that will contain the inputValue serialized as JSON.

Create<T>(T, MediaTypeHeaderValue, JsonSerializerOptions)

Creates a new instance of the JsonContent class that will contain the inputValue serialized as JSON.

Create<T>(T, JsonTypeInfo<T>, MediaTypeHeaderValue)

Creates a new instance of the JsonContent class that will contain the inputValue serialized as JSON.

Create(Object, JsonTypeInfo, MediaTypeHeaderValue)

Source:
JsonContent.cs
Source:
JsonContent.cs
Source:
JsonContent.cs
Source:
JsonContent.cs

Creates a new instance of the JsonContent class that will contain the inputValue serialized as JSON.

C#
public static System.Net.Http.Json.JsonContent Create(object? inputValue, System.Text.Json.Serialization.Metadata.JsonTypeInfo jsonTypeInfo, System.Net.Http.Headers.MediaTypeHeaderValue? mediaType = default);

Parameters

inputValue
Object

The value to serialize.

jsonTypeInfo
JsonTypeInfo

The JsonTypeInfo used to control the serialization behavior.

mediaType
MediaTypeHeaderValue

The media type to use for the content.

Returns

A JsonContent instance.

Applies to

.NET 10 és más verziók
Termék Verziók
.NET 8 (package-provided), 8, 9 (package-provided), 9, 10 (package-provided), 10
.NET Standard 2.0 (package-provided)

Create(Object, Type, MediaTypeHeaderValue, JsonSerializerOptions)

Source:
JsonContent.cs
Source:
JsonContent.cs
Source:
JsonContent.cs
Source:
JsonContent.cs
Source:
JsonContent.cs

Creates a new instance of the JsonContent class that will contain the inputValue serialized as JSON.

C#
public static System.Net.Http.Json.JsonContent Create(object? inputValue, Type inputType, System.Net.Http.Headers.MediaTypeHeaderValue? mediaType = default, System.Text.Json.JsonSerializerOptions? options = default);

Parameters

inputValue
Object

The value to serialize.

inputType
Type

The type of the value to serialize.

mediaType
MediaTypeHeaderValue

The media type to use for the content.

options
JsonSerializerOptions

Options to control the behavior during serialization, the default options are Web.

Returns

A JsonContent instance.

Applies to

.NET 10 és más verziók
Termék Verziók
.NET 5, 6, 7, 8 (package-provided), 8, 9 (package-provided), 9, 10 (package-provided), 10
.NET Standard 2.0 (package-provided)

Create<T>(T, MediaTypeHeaderValue, JsonSerializerOptions)

Source:
JsonContent.cs
Source:
JsonContent.cs
Source:
JsonContent.cs
Source:
JsonContent.cs
Source:
JsonContent.cs

Creates a new instance of the JsonContent class that will contain the inputValue serialized as JSON.

C#
public static System.Net.Http.Json.JsonContent Create<T>(T inputValue, System.Net.Http.Headers.MediaTypeHeaderValue? mediaType = default, System.Text.Json.JsonSerializerOptions? options = default);

Type Parameters

T

The type of the value to serialize.

Parameters

inputValue
T

The value to serialize.

mediaType
MediaTypeHeaderValue

The media type to use for the content.

options
JsonSerializerOptions

Options to control the behavior during serialization, the default options are Web.

Returns

A JsonContent instance.

Applies to

.NET 10 és más verziók
Termék Verziók
.NET 5, 6, 7, 8 (package-provided), 8, 9 (package-provided), 9, 10 (package-provided), 10
.NET Standard 2.0 (package-provided)

Create<T>(T, JsonTypeInfo<T>, MediaTypeHeaderValue)

Source:
JsonContent.cs
Source:
JsonContent.cs
Source:
JsonContent.cs
Source:
JsonContent.cs

Creates a new instance of the JsonContent class that will contain the inputValue serialized as JSON.

C#
public static System.Net.Http.Json.JsonContent Create<T>(T? inputValue, System.Text.Json.Serialization.Metadata.JsonTypeInfo<T> jsonTypeInfo, System.Net.Http.Headers.MediaTypeHeaderValue? mediaType = default);

Type Parameters

T

The type of the value to serialize.

Parameters

inputValue
T

The value to serialize.

jsonTypeInfo
JsonTypeInfo<T>

The JsonTypeInfo used to control the serialization behavior.

mediaType
MediaTypeHeaderValue

The media type to use for the content.

Returns

A JsonContent instance.

Applies to

.NET 10 és más verziók
Termék Verziók
.NET 8 (package-provided), 8, 9 (package-provided), 9, 10 (package-provided), 10
.NET Standard 2.0 (package-provided)