YamlNamingPolicyAttribute class
When placed on a type, property, or field, indicates what YamlNamingPolicy should be used to convert property names.
Namespace: System.Text.Yaml.Serialization ยท Assembly: Styml.dll
public class YamlNamingPolicyAttribute : YamlAttribute
Inheritance: object โ Attribute โ YamlAttribute โ YamlNamingPolicyAttribute
When placed on a type, property, or field, indicates what YamlNamingPolicy should be used to convert property names.
RemarksLink to this heading
When placed on a property or field, the naming policy specified by this attribute takes precedence over the type-level attribute and the YamlSerializerOptions.PropertyNamingPolicy. When placed on a type, the naming policy specified by this attribute takes precedence over the YamlSerializerOptions.PropertyNamingPolicy. The YamlPropertyNameAttribute takes precedence over this attribute.
ConstructorsLink to this heading
Initializes a new instance of YamlNamingPolicyAttribute with the specified known naming policy.
public YamlNamingPolicyAttribute(YamlKnownNamingPolicy namingPolicy);
Parameters
namingPolicy: The known naming policy to use for name conversion.
| Exception | Condition |
|---|---|
| ArgumentOutOfRangeException | The specified namingPolicy is not a valid known naming policy value. |
Initializes a new instance of YamlNamingPolicyAttribute with a custom naming policy.
protected YamlNamingPolicyAttribute(YamlNamingPolicy namingPolicy);
Parameters
namingPolicy: The naming policy to use for name conversion.
| Exception | Condition |
|---|---|
| ArgumentNullException | namingPolicy is null. |
PropertiesLink to this heading
NamingPolicyLink to this heading
Gets the naming policy to use for name conversion.
public YamlNamingPolicy NamingPolicy { get; }