YamlDerivedTypeAttribute class

When placed on a type declaration, indicates that the specified subtype should be opted into polymorphic serialization.

Namespace: System.Text.Yaml.Serialization ยท Assembly: Styml.dll

public class YamlDerivedTypeAttribute : YamlAttribute

Inheritance: object โ†’ Attribute โ†’ YamlAttribute โ†’ YamlDerivedTypeAttribute

When placed on a type declaration, indicates that the specified subtype should be opted into polymorphic serialization.

ConstructorsLink to this heading

Initializes a new attribute with specified parameters.

public YamlDerivedTypeAttribute(Type derivedType);

Parameters

  • derivedType: A derived type that should be supported in polymorphic serialization of the declared based type.

Initializes a new attribute with specified parameters.

public YamlDerivedTypeAttribute(Type derivedType, string typeDiscriminator);

Parameters

  • derivedType: A derived type that should be supported in polymorphic serialization of the declared base type.
  • typeDiscriminator: The type discriminator identifier to be used for the serialization of the subtype.

Initializes a new attribute with specified parameters.

public YamlDerivedTypeAttribute(Type derivedType, int typeDiscriminator);

Parameters

  • derivedType: A derived type that should be supported in polymorphic serialization of the declared base type.
  • typeDiscriminator: The type discriminator identifier to be used for the serialization of the subtype.

PropertiesLink to this heading

DerivedTypeLink to this heading

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

public Type DerivedType { get; }

TagLink to this heading

Gets or sets the YAML tag of the derived type under YamlTypeDiscriminatorStyle.Tag and YamlTypeDiscriminatorStyle.Both: a local tag (!dog) or a global tag URI (tag:example.com,2000:dog). When unset, the tag is ! followed by the type discriminator. A core tag (!!str), ! and ? are refused; under YamlTypeDiscriminatorStyle.Property the tag is checked and otherwise unused.

public string? Tag { get; set; }

TypeDiscriminatorLink to this heading

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

public object? TypeDiscriminator { get; }

Generated from the XML documentation of the libraryBuilt with Douze

Esc to close