YamlConverterAttribute class

When placed on a property, field, or type, specifies the converter type to use.

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

public class YamlConverterAttribute : YamlAttribute

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

When placed on a property, field, or type, specifies the converter type to use.

RemarksLink to this heading

The specified converter type must derive from YamlConverter. When placed on a property or field, the specified converter will always be used. When placed on a type, the specified converter will be used unless a compatible converter is added to YamlSerializerOptions.Converters or there is another YamlConverterAttribute on a property or field of the same type.

ConstructorsLink to this heading

Initializes a new instance of YamlConverterAttribute with the specified converter type.

public YamlConverterAttribute(Type converterType);

Parameters

  • converterType: The type of the converter.

Initializes a new instance of YamlConverterAttribute.

protected YamlConverterAttribute();

PropertiesLink to this heading

ConverterTypeLink to this heading

The type of the converter to create, or null if YamlConverterAttribute.CreateConverter should be used to obtain the converter.

public Type? ConverterType { get; }

MethodsLink to this heading

CreateConverterLink to this heading

If overridden and YamlConverterAttribute.ConverterType is null, allows a custom attribute to create the converter in order to pass additional state.

public virtual YamlConverter? CreateConverter(Type typeToConvert);

Returns: The custom converter.

Generated from the XML documentation of the libraryBuilt with Douze

Esc to close