YamlStringStyleAttribute Class

Overrides the style used to emit the string values written by the attributed member.

[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false)]
public sealed class YamlStringStyleAttribute : YamlAttribute

Remarks

Apply this attribute to a property or field whose value is a string or contains strings. The override is scoped to the serialization of that member value and affects the strings encountered below it, which includes the items of a collection and the values of a nested object. It does not affect mapping keys. See YamlScalarStylePreferences.StringStyle.

Inheritance
YamlAttribute YamlStringStyleAttribute

Constructors

NameDescription
YamlStringStyleAttribute(ScalarStyle)Initializes a new instance of the YamlStringStyleAttribute class.

YamlStringStyleAttribute(ScalarStyle)

YamlStringStyleAttribute.cs

Initializes a new instance of the YamlStringStyleAttribute class.

public YamlStringStyleAttribute(ScalarStyle style)

Parameters

style ScalarStyle
The style to use for string values.

Exceptions

ArgumentOutOfRangeException
style is not a defined ScalarStyle.

Properties

NameDescription
StyleGets the style to use for string values.

Gets the style to use for string values.

public ScalarStyle Style { get; }

Property value

ScalarStyle