Closed
Description
Now:
public enum SomeEnum {
Flag1 = 0b0, Flag2 = 0b1, Flag3 = 0b10
}
public void SomeMethod() {
SomeEnum options = SomeEnum.Flag1;
// Add Flag2
options |= SomeEnum.Flag2;
if (options & SomeEnum.Flag1) { } // True
if (options & SomeEnum.Flag3) { } // False
}
Sometimes such code is hard to understand. It would be nice to have a feature to compile multiple booleans or enums into a single enum using some structure. Let's call it cell. Here's how i see it:
public cell SomeOptions {
bool Flag1,
bool Flag2,
bool Flag3
}
public void SomeMethod() {
SomeOptions options = new SomeOptions();
options.Flag2 = true;
if (options.Flag1) { } // True
if (options.Flag3) { } // False
}
And it would compile into the code above with enum and bitwise operations.
Metadata
Metadata
Assignees
Labels
No labels