Skip to content

Serialize/deserialize flag enums in a nice way #32

@JimmyCushnie

Description

@JimmyCushnie
[Flags]
enum Flags
{
    None = 0,
    UnionJack = 1,
    USA = 2,
    Communist = 4,
    SouthKorea = 8,
}

// ...

var file = new DataFile("example");

var communistBritain = Flags.UnionJack | Flags.Communist;
file.Set("flags", communistBritain);

example.succ will contain the following:

flags: 5

It would be nicer if it contained something like this:

flags: UnionJack | Communist

or perhaps

flags: UnionJack, Communist

or maybe even

flags: UnionJack and Communist

Or maybe SUCC should support all three syntaxes, and the one that's used is a FileStyle setting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions