-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Please add HasAnyFlag(Enum flags) to Enum #9802
Comments
This was previously proposed in dotnet/runtime#69262. |
Judging by the policy, which implies support for old code, there will never be changes in this direction. Because this type is unique and will always be used in the code. I don't understand at all why this type is some kind of crutch in dotnet when there are many examples of using metacoding. For example, the "Record" type, which hide the implementation of classes under the hood in automatic mode. Why can't we do something similar with enums, so that it would be a full-fledged type that implements the IBinaryInteger interface and can be used in various generics? I gave an example of this type below:
|
@RioMcBoo if your proposal overcomes the pit of failures described in dotnet/runtime#69262, please file a new issue in that repo. |
Currently, there is already a HasFlag method, but it does not allow us to use enum as flags to its full potential. And we have to invent a new wheel.
All that is needed is for the Enum class to have two methods:
The text was updated successfully, but these errors were encountered: