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

Basic support for working with enums client-side #1404

Merged
merged 8 commits into from Oct 23, 2022
Merged

Conversation

exyi
Copy link
Member

@exyi exyi commented Jun 3, 2022

Added conversions from backing integer type to and from the enum string we use in view models.

This means that binary operators on enums work the same way as in C# (+, &, |, ~).
Also fixes #1302

@exyi exyi requested a review from a team June 11, 2022 11:17
@exyi exyi force-pushed the client-side-enums branch 3 times, most recently from 48d5a8a to bf52f15 Compare June 20, 2022 12:05
Added conversions from backing integer type to and from the enum string we use in view models.

This means that binary operators on enums work the same way as in C# (+, &, |, ~).
It should also fix #1302
Turns out this is bit hard to fix - Linq.Expression don't put
there Constant(MyEnum.X) but convert one side of the comparison
to int and then compare it with an int constant.
We'll either have to add some magic rewriting rules to handle this case
or add proper support for enum -> int conversions
Copy link
Member

@acizmarik acizmarik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix the comment. Apart from that - looks good 👍

@acizmarik acizmarik merged commit 3f9adea into main Oct 23, 2022
@acizmarik acizmarik deleted the client-side-enums branch October 23, 2022 10:01
@exyi exyi added this to the Version 4.1 milestone Jan 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ValueOrBinding.Select doesn't convert enum values to strings
2 participants