-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Composite enums #1079
Comments
I like your query style syntax for enums, that's something to think about in wider use cases... |
Good idea! |
And how do you propose this is represented under the covers? How will the compiler know which enum values have sub-values and which don't to provide accurate IntelliSense? What kind of code will the compiler spit out for your case of These are questions you need to provide an answer for. |
I like the idea of nested enums. |
I like the idea too |
Not the same but related: #587 |
It would be great to have a composite enums. What do you think about this idea?
It would be great to just write (with intellisense):
var x = Color.Blue.SkyBlue
Currently I often use enums like BlueCadet, BlueSky, BlueTurquoise because I am lazy and want Visual Studio to quickly offer exactly what I do want.
edit: I program automata with many states which I like to be compile constants. That's reason why I have enums with a lot of values and very similar names. It is nearly impossible to distinguish them and something like "folders" would help. I want to recycle some names and composite enums would be an option.
edit: I would also like to write something like:
case Blue
inswitch
. That could be just copying of the code fromBlue
case intoBlue.CadetBlue
, etc.edit: It would be also possible to do nothing with enums and introduce something like groups. It could look like:
It would be possible to access for example
Blue.SkyBlue
like an equivalent ofColor.SkyBlue
. Also it would be possible to write:The text was updated successfully, but these errors were encountered: