YamlEnumMemberNameAttribute Class

Specifies the YAML scalar used to represent an enum member.

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

Remarks

This is the YAML equivalent of System.Text.Json.Serialization.JsonStringEnumMemberNameAttribute. Apply it to an enum field to override the name emitted and accepted for that value.

Inheritance
YamlAttribute YamlEnumMemberNameAttribute

Constructors

NameDescription
YamlEnumMemberNameAttribute(string)Initializes a new instance of the YamlEnumMemberNameAttribute class.

YamlEnumMemberNameAttribute(string)

YamlEnumMemberNameAttribute.cs

Initializes a new instance of the YamlEnumMemberNameAttribute class.

public YamlEnumMemberNameAttribute(string name)

Parameters

name string
The YAML scalar used to represent the enum member.

Exceptions

ArgumentNullException
name is null.

Properties

NameDescription
NameGets the YAML scalar used to represent the enum member.

Gets the YAML scalar used to represent the enum member.

public string Name { get; }

Property value

string