-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Support generating explicit Equals/GetHashCode for records #81124
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
Conversation
| return obj is Program program && | ||
| b == program.b && | ||
| EqualityComparer<HashSet<string>>.Default.Equals(s, program.s); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
View with whitespace off.
| { | ||
| int a; | ||
| public virtual bool Equals(Program program) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question - should this be generated as Program?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup :)
|
|
||
| return CreateEqualsMethod( | ||
| compilation, | ||
| modifiers: isRecord ? containingType.IsSealed ? DeclarationModifiers.None : DeclarationModifiers.Virtual : null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it easier just to have the 'null' case be explicitly passing Overrides rather than defaulting it in the method? Looks like there's only two use sites...
No description provided.