<PackageReference Include="System.Text.Json" Version="8.0.5" />

JsonDerivedType

public struct JsonDerivedType
Represents a supported derived type defined in the metadata of a polymorphic type.
public Type DerivedType { get; }

Gets a derived type that should be supported in polymorphic serialization of the declared base type.

public object TypeDiscriminator { get; }

Gets the type discriminator identifier to be used for the serialization of the subtype.

public JsonDerivedType(Type derivedType)

Initializes a new instance of the JsonDerivedType class that represents a supported derived type without a type discriminator.

public JsonDerivedType(Type derivedType, int typeDiscriminator)

Initializes a new instance of the JsonDerivedType class that represents a supported derived type with an integer type discriminator.

public JsonDerivedType(Type derivedType, string typeDiscriminator)

Initializes a new instance of the JsonDerivedType class that represents a supported derived type with a string type discriminator.