Proposal: Analog for enums containing multiple options and bitwise operations with them #8738
Replies: 5 comments
-
I think there are three important dimensions here:
What you're proposing satisfies all points (1, 2 and 3). With current C#, you can satisfy any two points:
So, as long as you're willing to sacrifice one of the points, you can get what you want now. Because of that, I don't see adding a whole fundamental type kind to be worth it. |
Beta Was this translation helpful? Give feedback.
-
Maybe #107 would solve this? |
Beta Was this translation helpful? Give feedback.
-
There is a proposal in VB.net to extend the Dictionary Lookup Operator |
Beta Was this translation helpful? Give feedback.
-
Although I agree with @svick that adding a new 'kind of type' like that would not be worth it, I do think this could be accomplished by extending the language in another way. Remember how the
|
Beta Was this translation helpful? Give feedback.
-
in #1323 I suggested
with this implementation:
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Now:
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:
And it would compile into the code above with enum and bitwise operations.
Beta Was this translation helpful? Give feedback.
All reactions