Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EnumMember support "" #983

Closed
IvanJosipovic opened this issue Sep 25, 2024 · 1 comment · Fixed by #985
Closed

EnumMember support "" #983

IvanJosipovic opened this issue Sep 25, 2024 · 1 comment · Fixed by #985

Comments

@IvanJosipovic
Copy link

IvanJosipovic commented Sep 25, 2024

Describe the bug
When an Enum Member has the following annotation, EnumMember(Value = ""). The returned value should be "", as opposed to the Enum Member Name.

To Reproduce

Console.WriteLine("Start");

var yamlValue = new YamlDotNet.Serialization.Serializer().Serialize(EnumMemberedEnum.EmptyValue);

//yamlValue == "EmptyValue" // Should be '' as opposed to EmptyValue

var yamlObject = (new YamlDotNet.Serialization.Deserializer().Deserialize<EnumMemberedEnum>(yamlValue));

Console.WriteLine("End");

public enum EnumMemberedEnum
{
    No = 0,

    [System.Runtime.Serialization.EnumMember(Value = "goodbye")]
    Hello = 1,

    [System.Runtime.Serialization.EnumMember(Value = "")]
    EmptyValue = 2,

    [System.Runtime.Serialization.EnumMember()]
    NullValue = 3
}
@EdwardCooke
Copy link
Collaborator

It'll be fixed shortly, about to push up a PR with the fix and I'll try and get it out today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants