If I have an enum like this:

enum S  : string {
        foo = "a",
        baa = "b"
}


when I printed it, to my surprise I get the enum field name rather value:

writefln("%s v%s", S.foo, S.baa);     

output:

foo vbaa

instead of

a vb

a cast solves it but without cast everywhere I need that enum member, is there any other way to do it? otherwise I'll have to switch to a class with static immutable strings, right?

Reply via email to