Closed XenotropicDev closed 2 years ago
not sure if adding a dependency just to use one attribute is ideal. I think creating a custom attribute for this is better.
not sure if adding a dependency just to use one attribute is ideal. I think creating a custom attribute for this is better.
Sounds good to me, I will update the PR with a custom attribute class instead.
I updated the PR to no longer include any new dependencies, and added an internal attribute ChoiceDisplayAttribute
.
Please re-review.
This PR adds basic support for enum's that have been decorated with the
DisplayAttribute
fromSystem.ComponentModel.DataAnnotations
.I went with DisplayAttribute over other options because a lot of peoples enums might already be using this attribute from things like MVC, and it has support for localization. However doing so requires changing the project references to include the annotations library for the net461, and netstandard tagets (support is included in the core.app package for net5+). So if it would be better to use a custom attribute to avoid adding this package please let me know and I can modify the pull request.