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

Serialize/deserialize flag enums in a nice way #32

Open
JimmyCushnie opened this issue Nov 27, 2020 · 0 comments
Open

Serialize/deserialize flag enums in a nice way #32

JimmyCushnie opened this issue Nov 27, 2020 · 0 comments
Labels
feature/enhancement New feature or request

Comments

@JimmyCushnie
Copy link
Owner

[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.

@JimmyCushnie JimmyCushnie added the feature/enhancement New feature or request label Nov 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant