You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
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 property: on the attribute, e.g.:
recordR([property:Compare("J")]intI,intJ);
If you still think CompareAttribute should be changed, the right place to propose that is the dotnet/runtime repo.
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: