-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
CompareAttribute won't work on records values #191
Comments
This repo is not the right place to report issues, suggest improvements or ask questions about .Net. That being said, if you want to add an attribute to the property generated from a record primary constructor, you can do it by specifying record R([property: Compare("J")] int I, int J); If you still think |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The compare attribute when applied to a record parameter give the error message it is only valid on property or indexers.
Issue:
I was using the compare in a record to validate passwords. The error message was display. When I created a custom comparer and added the flag attributes of Parameter and Fields it resolved the issue.
Proposed Solution:
Add the attribute usage flag "AttributeTargets.Parameter". The AttributeTargets.Fields may also need to be added.
The text was updated successfully, but these errors were encountered: