< Summary

Information
Line coverage
0%
Covered lines: 0
Uncovered lines: 3
Coverable lines: 3
Total lines: 30
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

File(s)

C:\h\w\B31A098C\w\BB5A0A33\e\runtime-utils\Runner\runtime\src\libraries\System.Text.Json\src\System\Text\Json\Serialization\Attributes\JsonPolymorphicAttribute.cs

#LineLine coverage
 1// Licensed to the .NET Foundation under one or more agreements.
 2// The .NET Foundation licenses this file to you under the MIT license.
 3
 4namespace System.Text.Json.Serialization
 5{
 6    /// <summary>
 7    /// When placed on a type, indicates that the type should be serialized polymorphically.
 8    /// </summary>
 9    [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = false, Inherited = false)]
 10    public sealed class JsonPolymorphicAttribute : JsonAttribute
 11    {
 12        /// <summary>
 13        /// Gets or sets a custom type discriminator property name for the polymorphic type.
 14        /// Uses the default '$type' property name if left unset.
 15        /// </summary>
 016        public string? TypeDiscriminatorPropertyName { get; set; }
 17
 18        /// <summary>
 19        /// Gets or sets the behavior when serializing an undeclared derived runtime type.
 20        /// </summary>
 021        public JsonUnknownDerivedTypeHandling UnknownDerivedTypeHandling { get; set; }
 22
 23        /// <summary>
 24        /// When set to <see langword="true"/>, instructs the deserializer to ignore any
 25        /// unrecognized type discriminator id's and reverts to the contract of the base type.
 26        /// Otherwise, it will fail the deserialization.
 27        /// </summary>
 028        public bool IgnoreUnrecognizedTypeDiscriminators { get; set; }
 29    }
 30}