Enum Deserialization? #683
Unanswered
primem0ver
asked this question in
Q&A
Replies: 1 comment
-
Yes, you would use a , in the value. Example: var yaml = $"Enum: A, B, C";
var deserializer = new DeserializerBuilder().Build();
var value = deserializer.Deserialize<TestClass>(yaml);
Console.WriteLine(value.Enum);
Console.WriteLine((int)value.Enum);
[Flags]
enum TestEnum
{
A = 1,
B = 2,
C = 4
}
class TestClass
{
public TestEnum Enum { get; set; }
} Output:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Can I deserialize an enum? How about a Flags enum? With Enum names?
Beta Was this translation helpful? Give feedback.
All reactions