<PackageReference Include="System.Runtime.Serialization.Primitives" Version="4.0.11-beta-23409" />

KnownTypeAttribute

public sealed class KnownTypeAttribute : Attribute
Specifies types that should be recognized by the DataContractSerializer when serializing or deserializing a given type.
public string MethodName { get; }

Gets the name of a method that will return a list of types that should be recognized during serialization or deserialization.

public Type Type { get; }

Gets the type that should be recognized during serialization or deserialization by the DataContractSerializer.

public KnownTypeAttribute(Type type)

Initializes a new instance of the KnownTypeAttribute class with the specified type.

public KnownTypeAttribute(string methodName)

Initializes a new instance of the KnownTypeAttribute class with the name of a method that returns an IEnumerable of known types.