From a0a1dd96cdad764e340c5877896e92577134e69b Mon Sep 17 00:00:00 2001 From: kezenator Date: Mon, 21 Apr 2025 22:16:22 +1000 Subject: [PATCH] Update polymorphism.md --- .../serialization/system-text-json/polymorphism.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/docs/standard/serialization/system-text-json/polymorphism.md b/docs/standard/serialization/system-text-json/polymorphism.md index a0b2cf0b257b7..4af1bb748a83a 100644 --- a/docs/standard/serialization/system-text-json/polymorphism.md +++ b/docs/standard/serialization/system-text-json/polymorphism.md @@ -578,13 +578,12 @@ public class PolymorphicTypeResolver : DefaultJsonTypeInfoResolver { TypeDiscriminatorPropertyName = "$point-type", IgnoreUnrecognizedTypeDiscriminators = true, - UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FailSerialization, - DerivedTypes = - { - new JsonDerivedType(typeof(ThreeDimensionalPoint), "3d"), - new JsonDerivedType(typeof(FourDimensionalPoint), "4d") - } + UnknownDerivedTypeHandling = JsonUnknownDerivedTypeHandling.FailSerialization }; + jsonTypeInfo.PolymorphismOptions.DerivedTypes.Add( + new JsonDerivedType(typeof(ThreeDimensionalPoint), "3d")); + jsonTypeInfo.PolymorphismOptions.DerivedTypes.Add( + new JsonDerivedType(typeof(FourDimensionalPoint), "4d")); } return jsonTypeInfo;