JsonTypeInfo.CreateJsonPropertyInfo(Type, String) Method

Definition

Creates a blank JsonPropertyInfo instance for the current JsonTypeInfo.

C#
public System.Text.Json.Serialization.Metadata.JsonPropertyInfo CreateJsonPropertyInfo(Type propertyType, string name);

Parameters

propertyType
Type

The declared type for the property.

name
String

The property name used in JSON serialization and deserialization.

Returns

A blank JsonPropertyInfo instance.

Exceptions

propertyType or name is null.

propertyType cannot be used for serialization.

The JsonTypeInfo instance has been locked for further modification.

Applies to

Product Versions
.NET 7, 8 (package-provided), 8, 9 (package-provided), 9, 10 (package-provided), 10
.NET Standard 2.0 (package-provided)